xpath 2.0 for java possible

13,365

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.

Share:
13,365
Franz Kafka
Author by

Franz Kafka

Czech beer is awesome

Updated on June 15, 2022

Comments

  • Franz Kafka
    Franz Kafka almost 2 years

    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.

  • Igor G.
    Igor G. over 4 years
    Has anything changed, are there any other alternatives? Struggling to find anything on the topic.
  • Dimitre Novatchev
    Dimitre Novatchev over 4 years
    @IgorG. I am not aware of any new players in this field. There is now XPath 3.0 and 3.1, but these are usually encorporated in XSLT or XQuery processors, such as Saxon, BaseX, Marklogic, etc. It would be good to have a standalone XPath 3 processor.