Xpath over SVG tree (Batik)

T

thomas_escolan

Hi all,

I have a pb accessing a node within an XML tree, via XPath.
Loading a file and getting manually through it, I can see that it
contains the required structure, that is :

svg
g id=toto
g id=01
path
g id=02
path
path
path
path
path
g id=03
path
path
path
path
path
path
g id=04
path
path
path
path
g id=05
path
path
path
path
path

But this doesn't work :

XPath xpath = XPathFactory.newInstance().newXPath();
// final String expression = "//g[@id='" + _zone + "']/path";
Node node = (Node) xpath.evaluate("//g[@id='" + _zone + "']", _doc,
XPathConstants.NODE);
assert node != null : "Failure : " + _zone; // BING !
return (NodeList) xpath.evaluate("path", node,
XPathConstants.NODESET);

Does anybody know what I'm missing ? Is this that I the <g> tags are
imbricated ??
The XPath Explorer doesn't do the trick neither, even with it's own
generated expressions !
Thanks, Thomas.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,152
Latest member
LorettaGur
Top