I have this bit of code:
typedef CComQIPtr<MSXML::IXMLDOMDocument2> XML_DocumentPtr;
then inside some class:
XML_DocumentPtr m_spDoc;
then inside some function:
XML_NodePtr rn=m_spDoc->GetdocumentElement();
I cannot find anywhere in the MSDN documentation what that GetDocumentElement()
is supposed to do? Can anyone tell me why it doesn开发者_如何学JAVA't seem to be part of IXMLDOMDocument2
interface?
And which interface does have it?
IXMLDocument2
inherits from IXMLDocument
. The GetDocumentElement()
method is defined in that interface. See here.
Basically GetdocumentElement
returns the root element of the XML document.
The property is read/write. It returns an IXMLDOMElement that represents the single element that represents the root of the XML document tree. It returns Null if no root exists.
When setting the documentElement property, the specified element node is inserted into the child list of the document after any document type node. To precisely place the node within the children of the document, call the insertBefore method of theIXMLDOMNode.
The parentNode property is reset to the document node as a result of this operation.
GetdocumentElement
returns the root element of the document or NULL if no root exists.
精彩评论