1XML::LibXML::XPathExpreUssseironC(o3n)tributed Perl DocuXmMeLn:t:aLtiiboXnML::XPathExpression(3)
2
3
4
6 XML::LibXML::XPathExpression - XML::LibXML::XPathExpression - interface
7 to libxml2 pre-compiled XPath expressions
8
10 use XML::LibXML;
11 my $compiled_xpath = XML::LibXML::XPathExpression->new('//foo[@bar="baz"][position()<4]');
12
13 # interface from XML::LibXML::Node
14
15 my $result = $node->find($compiled_xpath);
16 my @nodes = $node->findnodes($compiled_xpath);
17 my $value = $node->findvalue($compiled_xpath);
18
19 # interface from XML::LibXML::XPathContext
20
21 my $result = $xpc->find($compiled_xpath,$node);
22 my @nodes = $xpc->findnodes($compiled_xpath,$node);
23 my $value = $xpc->findvalue($compiled_xpath,$node);
24
25 $compiled = XML::LibXML::XPathExpression->new( xpath_string );
26
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
30 if the same XPath query is evaluated many times.
31 "XML::LibXML::XPathExpression" objects can be passed to all "find..."
32 functions "XML::LibXML" that expect an XPath expression.
33
34 new()
35 $compiled = XML::LibXML::XPathExpression->new( xpath_string );
36
37 The constructor takes an XPath 1.0 expression as a string and
38 returns an object representing the pre-compiled expressions (the
39 actual data structure is internal to libxml2).
40
42 Matt Sergeant, Christian Glahn, Petr Pajas
43
45 2.0209
46
48 2001-2007, AxKit.com Ltd.
49
50 2002-2006, Christian Glahn.
51
52 2006-2009, Petr Pajas.
53
55 This program is free software; you can redistribute it and/or modify it
56 under the same terms as Perl itself.
57
58
59
60perl v5.38.0 2023-07-21 XML::LibXML::XPathExpression(3)