| 1 |
=head1 NAME |
| 2 |
|
| 3 |
XML::LibXML::XPathExpression - XML::LibXML::XPathExpression - interface to libxml2 pre-compiled XPath expressions |
| 4 |
|
| 5 |
=head1 SYNOPSIS |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
use XML::LibXML; |
| 10 |
my $compiled_xpath = XML::LibXML::XPathExpression->new('//foo[@bar="baz"][position()<4]'); |
| 11 |
|
| 12 |
# interface from XML::LibXML::Node |
| 13 |
|
| 14 |
my $result = $node->find($compiled_xpath); |
| 15 |
my @nodes = $node->findnodes($compiled_xpath); |
| 16 |
my $value = $node->findvalue($compiled_xpath); |
| 17 |
|
| 18 |
# interface from XML::LibXML::XPathContext |
| 19 |
|
| 20 |
my $result = $xpc->find($compiled_xpath,$node); |
| 21 |
my @nodes = $xpc->findnodes($compiled_xpath,$node); |
| 22 |
my $value = $xpc->findvalue($compiled_xpath,$node); |
| 23 |
|
| 24 |
$compiled = XML::LibXML::XPathExpression->new( xpath_string ); |
| 25 |
|
| 26 |
=head1 DESCRIPTION |
| 27 |
|
| 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. |
| 31 |
|
| 32 |
=over 4 |
| 33 |
|
| 34 |
=item new() |
| 35 |
|
| 36 |
$compiled = XML::LibXML::XPathExpression->new( xpath_string ); |
| 37 |
|
| 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 |
| 40 |
internal to libxml2). |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
=back |
| 45 |
|
| 46 |
=head1 AUTHORS |
| 47 |
|
| 48 |
Matt Sergeant, |
| 49 |
Christian Glahn, |
| 50 |
Petr Pajas |
| 51 |
|
| 52 |
|
| 53 |
=head1 VERSION |
| 54 |
|
| 55 |
2.0134 |
| 56 |
|
| 57 |
=head1 COPYRIGHT |
| 58 |
|
| 59 |
2001-2007, AxKit.com Ltd. |
| 60 |
|
| 61 |
2002-2006, Christian Glahn. |
| 62 |
|
| 63 |
2006-2009, Petr Pajas. |
| 64 |
|
| 65 |
=cut |
| 66 |
|
| 67 |
|
| 68 |
=head1 LICENSE |
| 69 |
|
| 70 |
This program is free software; you can redistribute it and/or modify it under |
| 71 |
the same terms as Perl itself. |
| 72 |
|