Microsoft XML SDK 2.6 - XML Reference

namespaces Property

Returns the list of namespaces used in the document as an XMLSchemaCache object. If there are no schemas, it returns an empty collection object.

Set objXMLDOMSchemaCache = objXMLDOMDocument2.namespaces

Remarks

There is one item in this list for each unique namespace declaration in the document. The schema collection returned may have an associated schema document for each namespace listed. This list is read-only. Any schema documents returned in this collection are also read-only.

The order of the namespaces returned does not necessarily match the order in which they appear in the document. The collection returned will change as new namespaces are added or removed via the DOM and in that sense it is a "live" list like XMLDOMNodeList.

This collection is completely reset each time you call load or loadXML.

Example

// Load a document (and any schemas referenced via X-Schema).
xmldoc.load ("somedata.xml");
// 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);

See Also

Applies To: XMLDOMSchemaCache