XML : Writing XML with VBScript & Microsoft.XMLDOM. Expecting unicode hex entities

I'm using VBScript to read & write xml files. I expect xml output files, where special characters are replaced with unicode hex entities.

Input xml:

  <root>  <nodes>      <node name="first">M&#x00FC;nchen&#x000D;&#x000A;N&#x00FC;rnberg&#x000D;&#x000A;K&#x00F6;lln</node>      <node name="second">M&#x00FC;nchen&#x000D;&#x000A;N&#x00FC;rnberg&#x000D;&#x000A;K&#x00F6;lln</node>  </nodes>    

VBScript:

  Dim xmlDoc : Set xmlDoc = CreateObject("Microsoft.XMLDOM")  xmlDoc.load "in.xml"  Dim nNode : Set nNode = xmlDoc.selectsinglenode ("//root/nodes/node[@name='first']")  if not nNode is nothing then       nNode.text = "München" & vbNewLine & "Nürnberg" & vbNewLine & "Kölln"      wscript.echo xmldoc.xml      xmldoc.save("out.xml")  else       WScript.Echo "not found..."  end if    

Output xml:

  <root>  <nodes>      <node name="first">München    Nürnberg  Kölln</node>      <node name="second">München  Nürnberg  Kölln</node>  </nodes>    

The output file should be encoded like the input file. Certainly, it is quite easy to solve, but i didn't found the solution :/ Would be great if anybody could help me.

No comments:

Post a Comment