|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Namespace 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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








