What version of XPath is implemented in XML :: LibXML?

Does anyone know which version of the XPath specification was implemented in XML :: LibMXL?

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

For example, I tried something like

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

which works fine but

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

not.

It follows from this that it supports no more than XPath 1.0 or some subset of 1.0 / 2.0.

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

+5
source share
3 answers

As you already understood from your research, XML :: LibXML supports XPath 1.0 (not 2.0).

Generally speaking, in XPath itself there is no way to determine the version, except using such probes. XSLT, on the other hand, provides a system-property('xsl:version') to identify version information.

Going to the original inheritance route: XML :: LibXML is based on libxml2, which implements XPath 1.0, as indicated directly on the Libxml2 home page:

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

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

You may ask why libxml2 does not support XPath 2.0? or read an old post from a companion, Daniel Weilard, that says the XPath 2.0 specification is "too big and intrusive," but the bottom line is: XML :: LibXML supports XPath 1.0, not 2.0.

+9
source

XML :: LibXML is the interface for libxml, so you will need to find out which version you installed. How you do this depends on your OS, but you can check the version of xsltproc or xmllint , for example:

 $ 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 have libxml v2.2.9.

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

+2
source

Well, this is not a 100% answer, but according to fooobar.com/questions/1203876 / ... (since 2012) libxml only supports XPath 1.0, and the supported string functions are described here: http://www.w3.org/TR / xpath / # section-String-Functions .

+1
source

Source: https://habr.com/ru/post/1203873/


All Articles