views:

51

answers:

3

Can anyone recommend me a java library to allow me XPath Queries over URLs? I've tried JAXP without success.

Thank you.

A: 

I've used JTidy to make HTML into a proper DOM, then used plain XPath to query the DOM.

If you want to do cross-document/cross-URL queries, better use JTidy with XQuery.

Tassos Bassoukos
Going to try it.
Reonarudo
+1  A: 

jsoup, Java HTML Parser Very similar to jQuery syntax way.

Artem Barger
Does it do XPath Queries?
Reonarudo
I'm not sure. It does much simpler queries, which xpath based. you can read some documentation and there are a lot of cool examples, explaining how to run that queries.
Artem Barger
+1  A: 

You could use TagSoup together with Saxon. That way you simply replace any XML SAX parser used with TagSoup and the XPath 2.0 or XSLT 2.0 or XQuery 1.0 implementation works as usual.

Martin Honnen
Going to try it.
Reonarudo