Details
Description
Jaxen is failing this test:
org.w3c.dom.Element root = doc.createElement("root");
doc.appendChild(root);
Element child = doc.createElementNS("http://www.example.org", "foo:child");
root.appendChild(child);
XPath xpath = new DOMXPath("//namespace::node()");
List result = xpath.selectNodes(doc);
assertEquals(3, result.size());
This query on this document should find three nodes: a namespace node for the xml prefix on the root, a namespace node for the xml prefix on the child, and a namespace node for the foo prefix on the child. It only finds the first two. (I've inspected this with the debugger.) For some reason it misses the foo prefix.
I haven't fully tracked this down yet. It might be a problem in the DOM navigator. It might be a problem in Jaxen itself.
I think I've figured out this bug. It's a problem in the DOM navigator. That navigator assumes that all namespace nodes are represented by Attr objects. However, this is not necessarily true for synthetically created documents. These may have namespaces but no Attr objects at all. It's basic DOM brain damage, and should not affect anything in the core or other navigators. I'm working on fixing it.