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.
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.