SĂ©bastien Ros <se**********@gmail.comwrote in
<11**********************@e51g2000hsg.googlegroups .com>:
I have to process the xmlns declarations in the root node
of a document.
Unfortunately, they are not recognized as elements nor as
attributes. Even with a /root/node() I can't reach them.
And if you think about it, it makes a lot of sense, too.
After all:
<root xmlns="http://example.org/foo">
<foo>
<bar/>
</foo>
</root>
is supposed to be equivalent to:
<foo:root xmlns:foo="http://example.org/foo">
<bar:foo xmlns:bar="http://example.org/foo">
<baz:bar xmlns:baz="http://example.org/foo"/>
</bar:foo>
</foo:root>
In a sense, xmlns declarations are merely syntactic sugar so
that we wouldn't have to write:
<{http://example.org/foo}foo>
<{http://example.org/foo}bar>
<{http://example.org/foo}baz/>
</{http://example.org/foo}bar>
</{http://example.org/foo}foo>
all the time. Because that's what both of the documents
above "really" mean. But, boy, wouldn't *that* be
cumbersome? So we have xmlns declarations, but they're
really just a serialization detail as far as many XML tools
are concerned.
--
Pavel Lepin