The XML object model in Internet Explorer 5 provides support for dealing with namespaces. The following properties allow you to extract the namespace, prefix, and base name for a given node.
| Property | Description |
|---|---|
| nodeName | Returns the qualified name for the node—that is, the tag name including the namespace prefix, if present. |
| namespaceURI | Returns the namespace for the element. If no namespace is specified on the node, "" is returned. |
| prefix | Returns the prefix specified on the element or attribute. If no prefix is specified, "" is returned. |
| baseName | Returns the name of the tag—that is, the text to the right of the colon. |
The following examples show some XML data followed by a table showing each element and attribute, as well as their properties in the XML object model:
<BOOKS>
<BOOK xmlns="urn:BookLovers.org:BookInfo">
<TITLE>A Suitable Boy</TITLE>
<PRICE currency="US Dollar">22.95</PRICE>
</BOOK>
</BOOKS>
| Node type | nodeName | namespaceURI | prefix | baseName |
|---|---|---|---|---|
| Element | BOOKS | BOOKS | ||
| Element | BOOK | urn:BookLovers.org:BookInfo | BOOK | |
| Attribute | xmlns | xmlns | ||
| Element | TITLE | urn:BookLovers.org:BookInfo | TITLE | |
| Element | PRICE | urn:BookLovers.org:BookInfo | PRICE | |
| Attribute | currency | currency |
<BOOKS> <bk:BOOK xmlns:bk="urn:BookLovers.org:BookInfo" xmlns:money="urn:Finance:Money"> <bk:TITLE>A Suitable Boy</bk:TITLE> <money:PRICE money:currency="US Dollar">22.95</money:PRICE> </bk:BOOK> </BOOKS>
| Node type | nodeName | namespaceURI | prefix | baseName |
|---|---|---|---|---|
| Element | BOOKS | BOOKS | ||
| Element | bk:BOOK | urn:BookLovers.org:BookInfo | bk | BOOK |
| Attribute | xmlns:bk | xmlns | bk | |
| Attribute | xmlns:money | xmlns | money | |
| Element | bk:TITLE | urn:BookLovers.org:BookInfo | bk | TITLE |
| Element | money:PRICE | urn:Finance:Money | bk | PRICE |
| Attribute | money:currency | urn:Finance:Money | money | currency |
The object model also extends support for creating and removing elements and attributes by taking namespaces into account.