Microsoft XML 2.5 SDK


 

IXMLDOMImplementation::hasFeature Method

[This is preliminary documentation and subject to change.]

Returns true if the specified version of the implementation supports the specified feature.

Visual Basic Syntax

boolVal = objXMLDOMImplementation.hasFeature(feature, version)

C++ Syntax

HRESULT hasFeature(

    BSTR feature,

    BSTR version,

    VARIANT_BOOL *hasFeature);

Parameters

feature

[in]
Feature to test. In Level 1, valid feature values are "XML," "DOM," and "MS-DOM" (case insensitive).

version

[in]
Version number to test, or, if null, tests for implementation of the feature in any version. In Level 1, "1.0" is the only valid version value.

hasFeature

[out]
True if the specified feature is implemented, or false otherwise.

C/C++ Return Value

Returns S_OK if successful, or an error code otherwise.

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 after finished using it.