Michael Ludwig wrote:
Hmmm... It appears that the parser completely ignores all 'xmlns'
attributes. The interesting thing is that it reads attributes from
other non-null namespaces.
The xmlns may look like an attribute, but it really isn't. It's a
namespace declaration, which happens to use attribute syntax.
I tried to find something in the specs... All I found is:
http://www.w3.org/TR/REC-xml/#sec-common-syn
Note:
The Namespaces in XML Recommendation [XML Names] assigns a meaning to
names containing colon characters. Therefore, authors should not use the
colon in XML names except for namespace purposes, but XML processors
*must* *accept* the colon as a name character.
According to this note, anything like foo:goo, xyz:abc, xmlns:123 must
be threated by XML parsers as names for elements/attributes. If the
parser is namespace aware then it should assign a special meaning to
names with colons inside.
Searching the specs deeper, I found:
http://www.w3.org/TR/xml-names/#ns-decl
[Definition: A namespace (or more precisely, a namespace binding) is
declared using a family of reserved attributes. Such an attribute's name
must either be xmlns or begin xmlns:. ...]
Hence a namespace declaration is an attribute with special meaning, but
still just an attribute.
That's why it doesn't show up among the attributes, neither in DOM nor in XDM
(XPath Data Model).
The Xerces DOM parser recognizes xmlns: prefixed attributes as
attributes. The problem was with the DTM parser used by Xalan.
Thanks for the feedback.
Michael Ludwig