OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: [xml-dev] namespaces

[ Lists Home | Date Index | Thread Index ]


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">

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" 

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...


See you in Barcelona.
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org

  • References:
    • namespaces
      • From: "Sven Ewert" <sven.ewert@satama.de>


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS