Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xpath 2.0 for java possible

Tags:

What package shall I use for XPath? I want wo query for elements and then extract some values around these nodes. Maybe one or more levels higher, some attributes.

javax.xml.xpath is XPath 1.0. Is javax.xml.xpath and org.w3c.dom the right way to go, or are there more modern implementations? org.w3c.dom is very awkward, JDOM seems alot easier.

like image 254
Franz Kafka Avatar asked Jul 08 '11 12:07

Franz Kafka


People also ask

Can we use the XPath in Java?

XPath Path ExpressionsXPath expressions can be used in JavaScript, Java, XML Schema, PHP, Python, C and C++, and lots of other languages.

Does browser engine support XPath 2.0 functions like ends with?

XPath 2.0 is fully included as a subset in XQuery 1.0, so you will be able to use all XPath 2.0 features (and more) in all browsers with JavaScript support.

What version of XPath does chrome use?

No, Chrome uses XPath 1.0.

What is XPath in Java?

What is XPath? XPath is a major element in the XSLT standard. XPath can be used to navigate through elements and attributes in an XML document. XPath stands for XML Path Language. XPath uses "path like" syntax to identify and navigate nodes in an XML document.


1 Answers

You may consider a Java-based XPath 2.0 or XQuery implementation (the XSLT 2.0 choice provides much more powerful functionality), such as Saxon 9.x.

Saxon is open source and one of the highest quality java-based processor so far and I am using it on a daily basis when answering SO XSLT/XPath/XQuery questions. In the documentation you will find good code examples.

The only stand-alone XPath 2.0 implementation I am aware of is PsychoPath, but I am not sure of its quality and usability.

like image 93
Dimitre Novatchev Avatar answered Sep 16 '22 14:09

Dimitre Novatchev