1XML::Parser::Lite::TreeU:s:eXrPaCtohn(t3r)ibuted Perl DoXcMuLm:e:nPtaartsieorn::Lite::Tree::XPath(3)
2
3
4
6 XML::Parser::Lite::Tree::XPath - XPath access to
7 XML::Parser::Lite::Tree structures
8
10 use XML::Parser::Lite::Tree;
11 use XML::Parser::Lite::Tree::XPath;
12
13 my $parser = new XML::Parser::Lite::Tree(process_ns => 1);
14 my $tree = $parser->parse($xml);
15
16 my $xpath = new XML::Parser::Lite::Tree::XPath($tree);
17 my $nodes = $xpath->select_nodes('/aaa');
18
19 my $nodes = $xpath->select_nodes('/*/*/parent::*');
20 my $nodes = $xpath->select_nodes('//ccc[ position() = floor(last() div 2 + 0.5) or position() = ceiling(last() div 2 + 0.5) ]');
21
23 This pure-Perl implementation of XPath is a complement to
24 XML::Parser::Lite::Tree, a pure-Perl XML tree parser and builder. It
25 aims to implement 100% of the W3C XPath specification.
26
28 "new( $tree )"
29 The constructor returns a new XPath parser for the given tree.
30
31 "query( $path )"
32 Returns a XML::Parser::Lite::Tree::XPath::Result object containing
33 the result of the query.
34
35 "select_nodes( $path )"
36 A convinience function around "query()" which returns 0 unless the
37 result is a nodeset, else returns the value of the nodeset.
38
40 Copyright (C) 2004-2008, Cal Henderson <cal@iamcal.com>
41
43 XML::Parser::Lite::Tree
44
45
46
47perl v5.12.3 2009-08-20 XML::Parser::Lite::Tree::XPath(3)