xpath 2.0 for java 可能
我应该为 XPath 使用什么包?我想要查询元素,然后提取这些节点周围的一些值。也许更高一个或多个级别,一些属性。
javax.xml.xpath
是 XPath 1.0。 javax.xml.xpath 和 org.w3c.dom 是正确的方法吗,还是有更现代的实现? org.w3c.dom
非常尴尬,JDOM 看起来容易多了。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以考虑基于 Java 的 XPath 2.0 或 XQuery 实现(XSLT 2.0 选择提供更强大的功能),例如 撒克逊 9.x。
Saxon 是开源的,是迄今为止质量最高的基于 Java 的处理器之一,我每天在回答 SO XSLT/XPath/XQuery 问题时都使用它。在文档中,您会找到很好的代码示例。
我知道的唯一独立的 XPath 2.0 实现是 PsychoPath,但是我不确定它的质量和可用性。
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.