开发者

XPath to parse JAX-RS result [duplicate]

This question already has answers here: How to use XPath on xml docs having default namespace (3 answers) Closed 7 years ago.

I don't know how to use XPath so I can parse the result of the XML I got from JAX-RS and put it into an ArrayList or something, here's the code I have so far, it generates a String... but I want to be able to use XPath to parse it, as it's better to parse XML rather than parsing String.

private Client client = Client.create();
    private List<String> venueName = new ArrayList<String>();

    private String getNearbyVenues(double lattitude, double longitude){
        WebResource webResource = client.resource("http://api.foursquare.com/v1/venues");
        MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
        queryParams.add("geolat", String.valueOf(lattitude));
        开发者_如何学GoqueryParams.add("geolong", String.valueOf(longitude));
        return webResource.queryParams(queryParams).get(String.class);
    }

The result goes something like this


Below is an answer of mine to another question that explains how to use the Java SE javax.xml.xpath libraries:

  • How to use XPath on xml docs having default namespace
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜