Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - DOM Reference

IXMLDOMDocument2

An extension of DOMDocument that supports schema caching and validation features, and switching on XML Path Language (XPath) support.

[Script]

Example

var objDoc = new ActiveXObject("Msxml2.DOMDocument.5.0");
var objFTDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.5.0");
[Visual Basic]

Example

Dim objDoc As New Msxml2.DOMDocument50
Dim objFTDoc As New Msxml2.FreeThreadedDOMDocument50
[C/C++]

Example

The following C/C++ example creates DOMDocument and queries for the IXMLDOMDocument2 interface.

HRESULT hr;
IXMLDOMDocument2 * pXMLDoc = NULL;

//...
hr = CoInitialize(NULL); // Check the return value, hr...
hr = CoCreateInstance(CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, 
       IID_IXMLDOMDocument2, (void**)&pXMLDoc); // Check the return value, hr...

Remarks

The following CLSIDs support IID_XMLDOMDocument2 in CoCreateInstance. The following progIDs return an object that can be cast into an IXMLDOMDocument2 interface in Microsoft® Visual Basic®. IXMLDOMDocument2 methods and properties are transparently available in late-bound scripting languages that go through IDispatch.

The same is true for DOMDocument objects exposed through the responseXML (IXMLHTTPRequest) property, and the DOMDocument and XSLDocument properties in the XML Multipurpose Internet Mail Extension (MIME) Viewer.

CLSID ProgID
CLSID_DOMDocument Msxml2.DOMDocument
CLSID_DOMFreeThreadedDocument Msxml2.FreeThreadedDOMDocument

Versioning

MSXML 2.6 and later

Requirements

Implementation: msxml4.dll, msxml2.lib

[C/C++]

Header and IDL files: msxml2.h, msxml2.idl

Version-Dependent ProgID: Msxml2.DOMDocument.5.0, Msxml2.FreeThreadedDOMDocument.5.0

Version-Dependent CLSID: 88d969c0-f192-11d4-a65f-0040963251e5

To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

IXMLDOMDocument2 Members | DOMDocument