IXMLDOMDocument Interface
Previous | Next |
IXMLDOMDocument Interface
The IXMLDOMDocument interface represents the top level of the XML source. It includes methods to obtain or create all of the other XML DOM interfaces. For more information, see the Microsoft XML SDK 3.0 documentation available at the Microsoft Web site.
In addition to the methods inherited from the IXMLDOMNode interface, the IXMLDOMDocument interface exposes the following methods.
Method | Description |
createAttribute | Creates a new attribute with the specified name. |
createElement | Creates an element node using the specified name. |
createNode* | Creates a node using the supplied type, name, and namespace. |
get_documentElement | Retrieves the root element of the document. |
get_implementation | Retrieves a pointer to the IXMLDOMImplementation object for this document. |
get_url* | Retrieves the canonical URL for the most recently loaded XML document. |
getElementsByTagName | Retrieves a collection of elements that have the name specified in this method call. |
putref_documentElement | Specifies the root element of the document. |
load* | Synchronously loads an XML document with the contents of the file at the specified location. |
loadXML* | Loads the supplied string into an XML document. |
save* | Saves an XML document to the specified location. |
* Denotes an extension to the W3C DOM.
Remarks
When the object-creation methods (such as createElement) are used on the document, nodes are created in the context of the document (the get_ownerDocument method of the node points to the document), but the node is not part of the document tree. The node is only part of the document tree when it is explicitly added to the tree by calling insertBefore, replaceChild, or appendChild (or for attributes, setAttributeNode).
Example Code
The following example retrieves a pointer to an IXMLDOMDocument interface.
#import "msxml3.dll" // Declare variables. IWMSServer* pServer; IXMLDOMDocument* pPlaylist; HRESULT hr; // Initialize the COM library and retrieve a pointer // to an IWMSServer interface. hr = CoInitialize(NULL); hr = CoCreateInstance(CLSID_WMSServer, NULL, CLSCTX_ALL, IID_IWMSServer, (void**)&pServer); if (FAILED(hr)) goto EXIT; // Create the playlist object. hr = pServer->CreatePlaylist(&pPlaylist); EXIT: // TODO: Release temporary COM objects and uninitialize COM.
See Also
Previous | Next |