[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Namespace prefix question

  • From: Kevin Williams <Kevin.Williams@u...>
  • To: "'XML-DEV@x...'" <XML-DEV@x...>
  • Date: Thu, 3 Feb 2000 15:04:30 -0500

prefix question
David,

> This is actually more of a confirmation than a question:  Can I use the
same
> namespace prefix more than once in an XML document, pointing to different
> namespaces?  Like the following:
> 
> <hi:element xmlns:hi="http://www.sernaferna.com">
>   <hi:element2 xmlns:hi="http://www.blah.com"/>
> </hi:element>

>From the "Namespaces in XML" recommendation:

5.1 Namespace Scoping

The namespace declaration is considered to apply to the element where it is
specified and to all elements within the content of that element, unless
overridden by another namespace declaration with the same NSAttName part...

So basically this means that in your example, all of the "hi:element"
element would have the "hi" namespace defined to be "www.sernaferna.com"
with the exception of the "hi:element2" element, which would have the "hi"
namespace defined to be "www.blah.com". This means that in this example:

<hi:element xmlns:hi="http://www.sernaferna.com">
  <hi:element2 xmlns:hi="http://www.blah.com"/>
  <hi:element3/>
</hi:element>

the "hi:element3" element would be in the "www.sernaferna.com" namespace.

Hope this helps -
Kevin

Kevin Williams (kwilliams@u...)
Co-author, _Professional XML_ (Wrox Press)
http://www.wrox.com/Consumer/Store/Details.asp?ISBN=1861003110


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.