namespaces Property
Returns the list of namespaces used in the document as XMLSchemaCache
.
[Script]
Script Syntax
objXMLDOMSchemaCollection = objIXMLDOMDocument2.namespaces;
Example
// 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); }
[Visual Basic]
Visual Basic Syntax
Set objXMLDOMSchemaCollection = objIXMLDOMDocument2.namespaces
Example
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
[C/C++]
C/C++ Syntax
HRESULT get_namespaces (IXMLDOMSchemaCollection ** namespaceCollection);
Parameters
- namespaceCollection [out, retval]
- Collection of all namespaces for the document.
Remarks
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.
See Also
Applies to: IXMLDOMSchemaCollection/XMLSchemaCache