Share via


IXMLDOMImplementation

 

Provides methods that are independent of any particular instance of the Document Object Model (DOM).

JScript Example

Note

You can use books.xml to run this sample code.

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.6.0");  
var oImplementation;  
xmlDoc.async = false;  
xmlDoc.load("books.xml");  
if (xmlDoc.parseError.errorCode != 0) {  
   var myErr = xmlDoc.parseError;  
   WScript.Echo("You have error " + myErr.reason);  
} else {  
   oImplementation = xmlDoc.implementation;  
   WScript.Echo (oImplementation.hasFeature("DOM", "1.0"));  
}  
  

Output

-1

Note

A value of -1 indicates that MSXML implements the specified feature. A value of 0 indicates the feature is not implemented.

C++ Example

IXMLDOMImplementation *pIXMLDOMImplementation = NULL;  
VARIANT_BOOL varbFlag ;  
BSTR bstrOutput = NULL;  
BSTR bstrFeature = ::SysAllocString(_T("MS-DOM"));  
HRESULT hr;  
IXMLDOMDocument *pIXMLDOMDocument = NULL;  
  
try  
{  
    // Create an instance of DOMDocument and initialize pIXMLDOMDocument.  
    // Load/create an XML fragment.  
    hr = pIXMLDOMDocument->get_implementation(&pIXMLDOMImplementation);  
  
    if(SUCCEEDED(hr) && pIXMLDOMImplementation)  
    {  
        hr = pIXMLDOMImplementation->hasFeature(bstrFeature, _T("1.0"), &varbFlag);  
        if(varbFlag == VARIANT_TRUE )  
            bstrOutput = ::SysAllocString(_T("Feature Supported"));  
        else  
            bstrOutput = ::SysAllocString(_T("Feature not Supported"));  
  
        ::MessageBox(NULL, bstrOutput, bstrFeature, MB_OK);  
        ::SysFreeString(bstrOutput);  
        bstrOutput = NULL;  
        ::SysFreeString(bstrFeature);  
        bstrFeature = NULL;  
        pIXMLDOMImplementation->Release();  
    }  
}  
catch(...)  
{  
    if(bstrOutput)  
        ::SysFreeString(bstrOutput);  
    if(bstrFeature)  
        ::SysFreeString(bstrFeature);  
    if(pIXMLDOMImplementation)  
        pIXMLDOMImplementation->Release();  
    DisplayErrorToUser();  
}  
// Release pIXMLDOMDocument when finished using it.  
  

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

Versioning

Implemented in: MSXML 3.0, MSXML 6.0

See Also

IXMLDOMImplementation Members
IXMLDOMDocument-DOMDocument