在XML :: LibXML中实现了什么版本的XPath?

时间:2022-10-20 18:45:51

Does anybody know which version of the XPath specification has been implemented in XML::LibMXL?

有谁知道在XML :: LibMXL中实现了哪个版本的XPath规范?

Or more to the point, where can I find a description of the XPath functions that I can use in LibXML?

或者更重要的是,在哪里可以找到我可以在LibXML中使用的XPath函数的描述?

For example, I tried something like

例如,我尝试过类似的东西

$dcDOM->findvalue('//dc:identifier[contains(@xsi:type,"URI")]');

which seems to work fine, but

这看起来很好,但是

$dcDOM->findvalue('//dc:identifier[matches(@xsi:type,"URI")]');

does not.

才不是。

From that one has to assume that it supports at most XPath 1.0 or some subset of 1.0/2.0 .

从那个开始,我必须假设它最多支持XPath 1.0或1.0 / 2.0的某个子集。

Is there a neat page where everything is listed and described?

是否有一个整洁的页面列出和描述了所有内容?

3 个解决方案

#1


8  

As you surmised from your probe, XML::LibXML supports XPath 1.0 (not 2.0).

正如您从探测中推测的那样,XML :: LibXML支持XPath 1.0(而不是2.0)。

Generally speaking, there is no way in XPath itself to ascertain the version other than through such probes. XSLT, on the other hand, provides system-property('xsl:version') for identifying version information.

一般来说,XPath本身无法确定除此类探测之外的版本。另一方面,XSLT提供用于标识版本信息的系统属性('xsl:version')。

Going the source heritage route: XML::LibXML is based on libxml2, which implements XPath 1.0, as stated right on the Libxml2 homepage:

走源遗产路线:XML :: LibXML基于libxml2,它实现了XPath 1.0,如Libxml2主页上所述:

Libxml2 implements a number of existing standards related to markup languages:

Libxml2实现了许多与标记语言相关的现有标准:

     XML Path Language (XPath) 1.0: http://www.w3.org/TR/xpath

You might ask Why doesn't libxml2 support XPath 2.0? or read an old post from maintainer Daniel Veillard that says that XPath 2.0 spec is "far too big and intrusive," but the bottom line remains: XML::LibXML supports XPath 1.0, not 2.0.

您可能会问为什么libxml2不支持XPath 2.0?或者从维护者Daniel Veillard那里读到一篇旧帖子,他说XPath 2.0规范“太大而且太干扰”,但底线仍然存在:XML :: LibXML支持XPath 1.0,而不是2.0。

#2


2  

XML::LibXML is an interface to libxml, so you would need to find out what version of that you have installed. How you do that depends on your OS, but you could check the version of xsltproc or xmllint, e.g.:

XML :: LibXML是libxml的接口,因此您需要找出已安装的版本。你如何做到这一点取决于你的操作系统,但你可以检查xsltproc或xmllint的版本,例如:

$ xsltproc --version
Using libxml 20900, libxslt 10128 and libexslt 817
xsltproc was compiled against libxml 20900, libxslt 10128 and libexslt 817
libxslt 10128 was compiled against libxml 20900
libexslt 817 was compiled against libxml 20900

So I've got libxml v2.2.9.

所以我有libxml v2.2.9。

According to the source of all wisdom, Wikipedia, libxml2 only implements XPath 1.0.

根据所有智慧的来源,*,libxml2只实现了XPath 1.0。

#3


1  

Ok, this is not the 100% answer, but according to https://*.com/a/10655581/2740187 (from 2012) libxml only supports XPath 1.0, and the supported string functions are described here: http://www.w3.org/TR/xpath/#section-String-Functions.

好的,这不是100%的答案,但根据https://*.com/a/10655581/2740187(2012年起),libxml仅支持XPath 1.0,支持的字符串函数如下所述:http:// www .w3.org / TR / XPath的/#部分字符串函数。

#1


8  

As you surmised from your probe, XML::LibXML supports XPath 1.0 (not 2.0).

正如您从探测中推测的那样,XML :: LibXML支持XPath 1.0(而不是2.0)。

Generally speaking, there is no way in XPath itself to ascertain the version other than through such probes. XSLT, on the other hand, provides system-property('xsl:version') for identifying version information.

一般来说,XPath本身无法确定除此类探测之外的版本。另一方面,XSLT提供用于标识版本信息的系统属性('xsl:version')。

Going the source heritage route: XML::LibXML is based on libxml2, which implements XPath 1.0, as stated right on the Libxml2 homepage:

走源遗产路线:XML :: LibXML基于libxml2,它实现了XPath 1.0,如Libxml2主页上所述:

Libxml2 implements a number of existing standards related to markup languages:

Libxml2实现了许多与标记语言相关的现有标准:

     XML Path Language (XPath) 1.0: http://www.w3.org/TR/xpath

You might ask Why doesn't libxml2 support XPath 2.0? or read an old post from maintainer Daniel Veillard that says that XPath 2.0 spec is "far too big and intrusive," but the bottom line remains: XML::LibXML supports XPath 1.0, not 2.0.

您可能会问为什么libxml2不支持XPath 2.0?或者从维护者Daniel Veillard那里读到一篇旧帖子,他说XPath 2.0规范“太大而且太干扰”,但底线仍然存在:XML :: LibXML支持XPath 1.0,而不是2.0。

#2


2  

XML::LibXML is an interface to libxml, so you would need to find out what version of that you have installed. How you do that depends on your OS, but you could check the version of xsltproc or xmllint, e.g.:

XML :: LibXML是libxml的接口,因此您需要找出已安装的版本。你如何做到这一点取决于你的操作系统,但你可以检查xsltproc或xmllint的版本,例如:

$ xsltproc --version
Using libxml 20900, libxslt 10128 and libexslt 817
xsltproc was compiled against libxml 20900, libxslt 10128 and libexslt 817
libxslt 10128 was compiled against libxml 20900
libexslt 817 was compiled against libxml 20900

So I've got libxml v2.2.9.

所以我有libxml v2.2.9。

According to the source of all wisdom, Wikipedia, libxml2 only implements XPath 1.0.

根据所有智慧的来源,*,libxml2只实现了XPath 1.0。

#3


1  

Ok, this is not the 100% answer, but according to https://*.com/a/10655581/2740187 (from 2012) libxml only supports XPath 1.0, and the supported string functions are described here: http://www.w3.org/TR/xpath/#section-String-Functions.

好的,这不是100%的答案,但根据https://*.com/a/10655581/2740187(2012年起),libxml仅支持XPath 1.0,支持的字符串函数如下所述:http:// www .w3.org / TR / XPath的/#部分字符串函数。