共用方式為


IXMLDOMDocument2

 

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

JScript Examples

The following JScript example demonstrates how to create the two types of objects.

var objDoc = new ActiveXObject("Msxml2.DOMDocument.6.0");  
var objFTDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.6.0");  
  

C++ Example

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

HRESULT hr;  
IXMLDOMDocument * pXMLDoc;  
IXMLDOMNode * pXDN;  
//...  
hr = CoInitialize(NULL);   
// Check the return value, hr...  
hr = CoCreateInstance(CLSID_DOMDocument30, NULL, CLSCTX_INPROC_SERVER,   
       IID_IXMLDOMDocument, (void**)&pXMLDoc);  
// Check the return value, hr...  
hr = pXMLDoc->QueryInterface(IID_IXMLDOMNode, (void **)&pXDN);  
// Check the return value.  
  

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

Requirements

Implementation:

msxml3.dll, msxml2.lib (MSXML 3.0)

msxml6.dll, msxml6.lib (MSXML 6.0)

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

For version-specific GUID and ProgIDs, see GUID and ProgID Information.

Versioning

Implemented in: MSXML 3.0 and MSXML 6.0

See Also

IXMLDOMDocument2 Members
IXMLDOMDocument-DOMDocument