XMLDOMImplementation Object
Because different applications that support XML can support different features of XML, the W3C included the XMLDOMImplementation object, which can be used to determine whether certain features are supported in a particular application. The XMLDOMImplementation object implements the IXMLDOMImplementation interface. This interface has one method called hasFeature that returns true if the specified feature is implemented by the specified version of the XML DOM implementation. To see how this object works, add another command button to the frmDOMTest form with the name cmdImplementation and the caption Implementation. Add the following code to the click event of this button:
Private Sub cmdImplementation _Click()
Dim objImplementation As IXMLDOMImplementation
Dim objXMLDoc As DOMDocument
Set objXMLDoc = New DOMDocument
objXMLDoc.async = False
objXMLDoc.Load ("c:\Books.xml")
Set objImplementation = objXMLDoc.implementation
'Currently accepted values for feature: XML, DOM, and MS-DOM
Debug.Print "MS-DOM: " & _
objImplementation.hasFeature("MS-DOM", "1.0")
Debug.Print "XML: " & _
objImplementation.hasFeature("XML", "1.0")
Debug.Print "DOM: " & _
objImplementation.hasFeature("DOM", "1.0")
End Sub
|
If you have Internet Explorer 5 installed on your computer, running this application and clicking the Implementation button will give you the following results:
MS-DOM: True XML: True DOM: True |
HasFeature returning true shows that Internet Explorer 5 supports XML, DOM, and the MS-DOM.