3 XML::LibXML::XPathExpression - XML::LibXML::XPathExpression - interface to libxml2 pre-compiled XPath expressions
10 my $compiled_xpath = new XML::LibXML::XPathExpression('//foo[@bar="baz"][position()<4]');
12 # interface from XML::LibXML::Node
14 my $result = $node->find($compiled_xpath);
15 my @nodes = $node->findnodes($compiled_xpath);
16 my $value = $node->findvalue($compiled_xpath);
18 # interface from XML::LibXML::XPathContext
20 my $result = $xpc->find($compiled_xpath,$node);
21 my @nodes = $xpc->findnodes($compiled_xpath,$node);
22 my $value = $xpc->findvalue($compiled_xpath,$node);
24 $compiled = XML::LibXML::XPathExpression->new( xpath_string );
28 This is a perl interface to libxml2's pre-compiled XPath expressions.
29 Pre-compiling an XPath expression can give in some performance benefit if the
30 same XPath query is evaluated many times. C<<<<<< XML::LibXML::XPathExpression >>>>>> objects can be passed to all C<<<<<< find... >>>>>> functions C<<<<<< XML::LibXML >>>>>> that expect an XPath expression.
36 $compiled = XML::LibXML::XPathExpression->new( xpath_string );
38 The constructor takes an XPath 1.0 expression as a string and returns an object
39 representing the pre-compiled expressions (the actual data structure is
59 2001-2007, AxKit.com Ltd.
61 2002-2006, Christian Glahn.
63 2006-2009, Petr Pajas.