Executing xpath in android
I want to parse an XML file (execute XPATH)
I use开发者_运维问答d SAX and not JDOM
How can i give item from query
thank you
There is a small example in the javax.xml.xpath package description:
XPath xpath = XPathFactory.newInstance().newXPath();
String expression = "/widgets/widget";
InputSource inputSource = new InputSource("widgets.xml");
NodeSet nodes =
(NodeSet) xpath.evaluate(expression, inputSource, XPathConstants.NODESET);
If you already have a NodeList
then I think you can use a different evaluate method instead.
精彩评论