xpath 2.0 for java可能 [英] xpath 2.0 for java possible

查看:397
本文介绍了xpath 2.0 for java可能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该为XPath使用什么包?我想要查询元素,然后提取这些节点周围的一些值。可能一个或多个级别更高,一些属性。



javax.xml.xpath 是XPath 1.0。是和 org.w3c.dom 正确的方法,或者有更现代化的实现? org.w3c.dom 非常尴尬,JDOM似乎更容易。

解决方案

p> 您可以考虑基于Java的XPath 2.0或XQuery实现(XSLT 2.0选项提供更强大的功能),例如 Saxon 9.x



Saxon是开放源码,是目前为止最高质量的基于java的处理器之一,我正在使用它每天在回答SO XSLT / XPath / XQuery问题时。在文档中您将找到很好的代码示例。



我所知道的唯一独立的XPath 2.0实现是 PsychoPath ,但我不确定其质量和可用性。


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.

解决方案

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.

这篇关于xpath 2.0 for java可能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆