With the help of VTD-XML, I want to find all attributes belonging to a namespace knowing only its uri.
Here is my code:
VTDGen vg = new VTDGen();
vg.setDoc("<root xmlns=\"urn:foo\" xmlns:nsBar=\"urn:nsBar\" nsBar:Baz=\"value\"/>".getBytes());
vg.parse(true);
VTDNav n = vg.getNav();
AutoPilot autoPilot = new AutoPilot(n);
autoPilot.selectXPath("//@*[namespace-uri()='urn:nsBar']");
//autoPilot.selectXPath("//@*[namespace-uri()='urn:foo']");
int r;
while( (r= autoPilot.evalXPath()) != -1) {
System.out.println("°°° " + n.toString(r));
}
The below code outputs nothing. If you uncomment the commented line and comment the previous one, you get this:
°°° nsBar:Baz
However nsBar:Baz
belongs to the nsBar
namespace. The uri of this namespace is urn:nsBar
.
What's wrong with vtd-xml here ?