xpath 2.0 for java 可能
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6624149/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
xpath 2.0 for java possible
提问by Franz Kafka
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.
我应该为 XPath 使用什么包?我想要对元素进行查询,然后在这些节点周围提取一些值。也许更高一层或多层,一些属性。
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.
javax.xml.xpath
是 XPath 1.0。是javax.xml.xpath
和org.w3c.dom
走正道,还是有更现代的实现?org.w3c.dom
很尴尬,JDOM 似乎容易多了。
采纳答案by Dimitre Novatchev
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.
您可以考虑一个基于Java的XPath 2.0或XQuery实现(XSLT 2.0的选择提供了更多强大的功能),如撒克逊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.
Saxon 是开源的,是迄今为止最高质量的基于 Java 的处理器之一,我每天在回答 SO XSLT/XPath/XQuery 问题时都在使用它。在文档中,您会找到很好的代码示例。
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 实现是PsychoPath,但我不确定它的质量和可用性。