Click to return to the XML (Extensible Markup Language) home page    
Declaring Namespaces     Namespace Scope     Introduction to Namespace...    
Web Workshop  |  XML (Extensible Markup Language)

Object Model Support


The XML object model in Internet Explorer 5 provides support for dealing with namespaces. The following properties provide the facility to extract the namespace, prefix, and base name for a given node.

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 there is no namespace on the node, "" is returned.
prefix Returns the prefix specified on the element or attribute. If there is no prefix specified, "" is returned.
baseName Returns the name of the tag, that is, the right-hand side 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 typenodeNamenamespaceURIprefixbaseName
ELEMENTBOOKSBOOKS
ELEMENTBOOKurn:BookLovers.org:BookInfoBOOK
ATTRIBUTExmlnsxmlns
ELEMENTTITLEurn:BookLovers.org:BookInfoTITLE
ELEMENTPRICEurn:BookLovers.org:BookInfoPRICE
ATTRIBUTEcurrencycurrency
<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 typenodeNamenamespaceURIprefixbaseName
ELEMENTBOOKSBOOKS
ELEMENTbk:BOOKurn:BookLovers.org:BookInfobkBOOK
ATTRIBUTExmlns:bkxmlnsbk
ATTRIBUTExmlns:moneyxmlnsmoney
ELEMENTbk:TITLEurn:BookLovers.org:BookInfobkTITLE
ELEMENTmoney:PRICEurn:Finance:MoneybkPRICE
ATTRIBUTEmoney:currencyurn:Finance:Moneymoneycurrency

The object model also extends support for creating and removing elements and attributes by taking namespaces into account.



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.