Given the following input document:
<Urmel a="1" b="2" xmlns="urn:x-U" xmlns:v="urn:x-V"/>
And the following code:
static void showAttributes(Document doc) {
Node docElm = doc.getDocumentElement();
NamedNodeMap nodeMap = docElm.getAttributes();
int len = nodeMap.getLength();
for (int i = 0; i < len; i++) {
Attr attr = (Attr) nodeMap.item(i);
System.out.println(attr.getName() + " " + attr);
}
}
Four attributes are shown:
a a="1"
b b="2"
xmlns xmlns="urn:x-U"
xmlns:v xmlns:v="urn:x-V"
Do namespace declaration attributes count as real attributes in the DOM?
I noticed that contrary to Xerces, LibXML2 does not count namespace
declaration attributes among the real attributes.
Can I make the Xerces parser or the document not include them among the
attributes? (In the XPath Data Model, they're not attributes.)
Or do they filter out the xmlns: attributes by checking the prefix and
the namespace URI when building the XDM from the DOM?
Michael Ludwig
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]