我尝试在XPath 2.0
中使用//span/string(.)
exp libxml2
,但它不起作用。
所以,我的问题是:libxml2
是否支持XPath 2.0
?
答案 0 :(得分:14)
根据libxml2维护者的this 2007 email,libxml2不支持XPath 2.0,也不支持XPath 2.0。
答案 1 :(得分:0)
您可能对an XPath 2.0 extension to libxml2感兴趣 - 但是,有2个警告适用:它正在进行中,并且仅供非商业用途免费使用。
希望这有帮助,
最好的问候,carsten
PS: 我既不隶属于在libx工作的人,也没有任何使用它的个人经验或超出其网站信息的知识。
答案 2 :(得分:0)
Libxml2实现了许多与标记语言相关的现有标准:
the XML standard: http://www.w3.org/TR/REC-xml Namespaces in XML: http://www.w3.org/TR/REC-xml-names/ XML Base: http://www.w3.org/TR/xmlbase/ RFC 2396 : Uniform Resource Identifiers http://www.ietf.org/rfc/rfc2396.txt XML Path Language (XPath) 1.0: http://www.w3.org/TR/xpath HTML4 parser: http://www.w3.org/TR/html401/ XML Pointer Language (XPointer) Version 1.0: http://www.w3.org/TR/xptr XML Inclusions (XInclude) Version 1.0: http://www.w3.org/TR/xinclude/ ISO-8859-x encodings, as well as rfc2044 [UTF-8] and rfc2781 [UTF-16] Unicode encodings, and more if using iconv support part of SGML Open Technical Resolution TR9401:1997 XML Catalogs Working Draft 06 August 2001: http://www.oasis-open.org/committees/entity/spec-2001-08-06.html Canonical XML Version 1.0: http://www.w3.org/TR/xml-c14n and the Exclusive XML Canonicalization CR draft http://www.w3.org/TR/xml-exc-c14n Relax NG, ISO/IEC 19757-2:2003, http://www.oasis-open.org/committees/relax-ng/spec-20011203.html W3C XML Schemas Part 2: Datatypes REC 02 May 2001 W3C xml:id Working Draft 7 April 2004
由于libxml2支持XPath 1.0,因此语法不正确:
//span/string(.)
应该是:
string(//span/.)
为了澄清,string
方法也是XPath 1.0的一部分。供将来参考:
libxml2支持XPath 1.0
Objective-C通过GNUStep / NextStep中的NSXMLNode nodesForXPath
方法支持XPath 2.0
Cocoa实现使用XPath 2.0,这是万维网联盟的推荐。
<强>参考强>
答案 3 :(得分:-1)
据我所知 - 不是。流行的大部分XPath 2.0实现都是XSLT 2.0处理器或XQuery处理器的一部分。