Returns the list of namespaces used in the document as XMLSchemaCache
.
objXMLDOMSchemaCollection = objIXMLDOMDocument2.namespaces;
// Load a document (and any schemas referenced via X-Schema). xmldoc.load ("somedata.xml"); if (xmlDoc.parseError.errorCode <> 0) { var myErr = xmlDoc.parseError; alert("You have error " + myErr.reason); } else { // Get the namespace of the root element. var namespaceURI = xmldoc.documentElement.namespaceURI; // Find the schema associated with the namespace. var schema = xmldoc.namespaces.get(namespaceURI); }
Set objXMLDOMSchemaCollection = objIXMLDOMDocument2.namespaces
Dim xmlDoc As New Msxml2.DOMDocument50 Dim namespaceURI As String Dim schema As XMLSchemaCache50 ' Load a document (and any schemas referenced via X-Schema). xmlDoc.Load ("books.xml") If (xmlDoc.parseError.errorCode <> 0) Then Dim myErr Set myErr = xmlDoc.parseError MsgBox("You have error " & myErr.reason) Else ' Get the namespace of the root element. namespaceURI = xmlDoc.documentElement.namespaceURI ' Find the schema associated with the namespace. Set schema = xmlDoc.namespaces.get(namespaceURI) End If
HRESULT get_namespaces (IXMLDOMSchemaCollection ** namespaceCollection);
If there are no schemas, it returns an empty collection.
To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button in the upper-left corner of the page.
Applies to: IXMLDOMSchemaCollection/XMLSchemaCache