使用installscirpt修改xml文件时出现乱码

时间:2012-02-14 10:48:40

标签: msxml6

我们想要修改xml文件的节点,例如web.config,我们在保存文件后会收到乱码。我们使用的代码如下:

   set  xmlDocument = CoCreateObject("Msxml2.DOMDocument.4.0");
   if (!IsObject(xmlDocument)) then
      return -1;
   endif;

   xmlDocument.async=FALSE; 
   xmlDocument.setProperty("SelectionLanguage","XPath");
   xmlDocument.load(xmlFileName);
   if(IsObject(xmlDocument)=FALSE) then
      return -1;       
   endif;
   set xmlNode = xmlDocument.selectSingleNode(nodePath);
   if(IsObject(xmlNode)=TRUE) then
   xmlNode.Attributes.getNamedItem("value").nodeValue = value;
   xmlDocument.save(xmlFileName);

我尝试使用多种方法来解决此问题,例如在xml文件头中使用BOM或编码。 但我找不到正确的方法。

现在我想知道两件事:

  1. 修改后的文件编码。
  2. 使用其编码修改文件。
  3. 谁可以帮助我?

0 个答案:

没有答案