[
Lists Home |
Date Index |
Thread Index
]
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:
- namespaces
- From: "Sven Ewert" <sven.ewert@satama.de>
|