Microsoft XML SDK 2.6 - XML Reference

IXMLDOMDocument::implementation Method

IXMLDOMDocument::get_implementation Method

Contains a pointer to the XMLDOMImplementation object for this document.

Visual Basic Syntax

Set objXMLDOMImplementation = oXMLDOMDocument.implementation

C/C++ Syntax

HRESULT get_implementation(
    IXMLDOMImplementation **impl);

Parameters

impl [out]
XMLDOMImplementation object for this document.

C/C++ Return Values

S_OK
Value returned if successful.
E_INVALIDARG
Value returned if impl is Null.

Remarks

A DOM application can use objects from multiple implementations. This provides access to the XMLDOMImplementation object that handles this document.

Example

IXMLDOMDocument * pIXMLDOMDocument = NULL;
IXMLDOMImplementation *pIXMLDOMImplementation = NULL;
VARIANT_BOOL varbFlag ;
BSTR bstrOutput = NULL;
BSTR bstrFeature = ::SysAllocString(_T("MS-DOM"));

try
{
   // Initialize pIXMLDOMDocument (create a DOMDocument).
   // Load document.
   hr = pIXMLDOMDocument->get_implementation (&pIXMLDOMImplementation);

   if(SUCCEEDED(hr) && pIXMLDOMImplementation)
   {
      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);
      pIXMLDOMImplementation->Release();
      pIXMLDOMImplementation = NULL;
      ::SysFreeString(bstrOutput);
      bstrOutput = NULL;
   }
   ::SysFreeString(bstrFeature);
   bstrFeature = NULL;
}
catch(...)
{
   if(pIXMLDOMImplementation)
      pIXMLDOMImplementation->Release();
   if(bstrOutput)
      ::SysFreeString(bstrOutput);
   if(bstrFeature)
      ::SysFreeString(bstrFeature);
   DisplayErrorToUser();
}
// Release pIXMLDOMDocument when finished with it.

See Also

IXMLDOMDocument Interface