implementation Property

MSXML 5.0 SDK

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

implementation Property

Contains the IXMLDOMImplementation object for the document.

[Script]

Script Syntax

var objXMLDOMImplementation = oXMLDOMDocument.implementation;

Example

The following script example creates an IXMLDOMImplementation object.

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;
}
[Visual Basic]

Visual Basic Syntax

Set objXMLDOMImplementation = oXMLDOMDocument.implementation

Example

The following Microsoft® Visual Basic® example creates an IXMLDOMImplementation object.

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
End If
[C/C++]

C/C++ Syntax

HRESULT get_implementation(
    IXMLDOMImplementation **impl);

Parameters

impl [out, retval]
The IXMLDOMImplementation for this document.

C/C++ Return Values

S_OK
The value returned if successful.
E_INVALIDARG
The value returned if the impl parameter is Null.

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.

Remarks

The property is read-only. An XML Document Object Model (DOM) application can use objects from multiple implementations. This property provides access to IXMLDOMImplementation that handles this document.

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

Applies to: DOMDocument