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

Re: namespaces


sven ewert and gecko
Hi,

Sven Ewert wrote:
> hi all,
> 
> is it "valid" when i use a namespace in the root element of
> an xml file and then in no other element?
> or is it totaly false and non standart ?
> 
> like:
>  <name:blub xmlns:name="URI">
>    <element>
>      <foo/>
>      <bar/>
>    </element>
>  </name:blub>

This is perfectly valid per the Namespaces in XML recommendation.

Now, the question you need to ask to yourself is if you prefer this for 
your application rather than:

<blub xmlns="URI">
  <element>
   <foo/>
   <bar/>
  </element>
</name:blub>

In the first case, blub will be considered to be in the "URI" namespace 
and all the other elements will be considered to have no namespace while 
in the second one all the elements will be considered to be in the "URI" 
namespace.

The main difference is that generic namespace applications will find the 
information about the namespace only in the document element in the 
first case and in every element node in the second one.

I would say that this is not a FAQ since no definite answer can be 
given, but that this is certainly a frequent question!

In fact, I think that in practice, namespaces fade out... and the color 
of an element is not only its color but also the color of its ancestors...

To take the often used metaphor, if the namespace "URI" is blue, your 
element "foo" will not be white but light blue!

Now, it may be more difficult for some applications to recognize "light 
blue" than plain "blue" but you may also think that you will use much 
less painting and be less agressive for the eyes if you just paint the 
document element...

Eric

-- 
See you in Barcelona.
                               http://www.xmleurope.com/2002/schedule.asp
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
------------------------------------------------------------------------


  • References:

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.