Contains the XML representation of the node and all its descendants.
strValue = oXMLDOMNode.xml
HRESULT get_xml( BSTR *xmlString);
Note that the xml method always returns a Unicode string (BSTR). That is, the xml method for the document object converts the document from its original encoding into Unicode. As a result, the original encoding attribute is removed. For example,
<?xml version="1.0" encoding="UTF-8"?>
appears in the xml method as
<?xml version="1.0"?>
If the original encoding wasn't removed by the xml method, the following line would return an error indicating the parser cannot switch from Unicode to UTF-8 encoding:
xmlDoc.loadxml(xmlDoc.xml);
If you use IXMLDOMDocument::save(), the original encoding will be preserved. So if you load a document in Windows-1252 encoding, it will be saved in that format, and so on.
This value depends on the value of the nodeType method.
NODE_ATTRIBUTE, NODE_CDATA_SECTION, NODE_COMMENT, NODE_DOCUMENT, NODE_ELEMENT, NODE_ENTITY, NODE_NOTATION, NODE_PROCESSING_INSTRUCTION, NODE_TEXT | Returns the string representation of the node and all its descendants. |
NODE_DOCUMENT_FRAGMENT | Returns the string representation of all descendant nodes of the document fragment. |
NODE_DOCUMENT_TYPE | Returns the string representation of the <!DOCTYPE ...> declaration, including the internal subset if specified. |
NODE_ENTITY_REFERENCE | Returns the string representation of the entity reference. Although the entity reference has children, they are not returned. |
When manipulating a document, it is possible to create a document that lacks the appropriate namespace declarations to be reparsed, or to have declarations that would cause some prefixed names to be interpreted incorrectly. When saving an XML representation of DOM nodes, the Microsoft XML Parser (MSXML) attempts to insert appropriate namespace declarations to preserve the original namespace URI for each element and its attributes.
IXMLDOMNode Interface | Handling White Space | XML DOM Persistence