开发者

Executing xpath in android

开发者 https://www.devze.com 2023-02-20 04:47 出处:网络
I want to parse an XML file (execute XPATH) I use开发者_运维问答d SAX and not JDOM How can i give item from query

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消