Can I use relative XPath expressions in libxml2?

Posted by brbr on Stack Overflow See other posts from Stack Overflow or by brbr
Published on 2010-05-13T16:08:24Z Indexed on 2010/05/13 16:14 UTC
Read the original article Hit count: 285

Filed under:
|
|
|

I am wondering whether it is possible to use relative XPath expressions in libxml2.

This is from the javax.xml.xpath API and I would like to do the similar thing using libxml2:

Node widgetNode = (Node) xpath.evaluate(expression, document, XPathConstants.NODE);

With a reference to the element, a relative XPath expression can now written to select the child element:

XPath xpath = XPathFactory.newInstance().newXPath();
String expression = "manufacturer";
Node manufacturerNode = (Node) xpath.evaluate(expression, **widgetNode**, XPathConstants.NODE);

© Stack Overflow or respective owner

Related posts about libxml2

Related posts about xpath