IXMLDOMImplementation

MSXML 5.0 SDK

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

IXMLDOMImplementation

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

[Script]

Example

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

Example

Dim xmlDoc As New Msxml2.DOMDocument50
Dim oImplementation As IXMLDOMImplementation
xmlDoc.async = False
xmlDoc.Load "books.xml"
If (xmlDoc.parseError.errorCode <> 0) Then
   Dim myErr
   Set myErr = xmlDoc.parseError
   MsgBox("You have error " & myErr.reason)
Else
   Set oImplementation = xmlDoc.implementation
   MsgBox oImplementation.hasFeature("DOM", "1.0")
End If
[C/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.

Versioning

MSXML 2.0 and later

Requirements

Implementation: msxml5.dll, msxml2.lib

[C/C++]

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

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

IXMLDOMImplementation Members | DOMDocument