根据微软的说明,Microsoft.XMLDOM xml属性取出的XML串是没有encoding属性的,只有save方法才有。参见微软的MSDN说明:
http://msdn.microsoft.com/en-us/library/ms755989(v=VS.85).aspx
The property is read-only.
The xml property always returns a Unicode string. That is, the xml property for DOMDocument converts the document from its original encoding to Unicode. As a result, the original encoding attribute is removed. For example, <?xml version="1.0" encoding="UTF-8"?> appears in the xml property as follows.
<?xml version="1.0"?>
If the original encoding was not removed by the xml property, the following line returns an error indicating the parser cannot switch from Unicode to UTF-8 encoding.
xmlDoc.loadxml(xmlDoc.xml);
If you use the save method, the original encoding is preserved. For example, if you load a document in Microsoft® Windows® 1252 encoding, it will be saved in that format.
This value depends on the value of the nodeType property.