The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

XML::Parser::Lite::Tree::XPath - XPath access to XML::Parser::Lite::Tree structures

SYNOPSIS

  use XML::Parser::Lite::Tree;
  use XML::Parser::Lite::Tree::XPath;

  my $parser = new XML::Parser::Lite::Tree(process_ns => 1);
  my $tree = $parser->parse($xml);

  my $xpath = new XML::Parser::Lite::Tree::XPath($tree);
  my $nodes = $xpath->select_nodes('/aaa');

  my $nodes = $xpath->select_nodes('/*/*/parent::*');
  my $nodes = $xpath->select_nodes('//ccc[ position() = floor(last() div 2 + 0.5) or position() = ceiling(last() div 2 + 0.5) ]');

DESCRIPTION

This pure-Perl implementation of XPath is a complement to XML::Parser::Lite::Tree, a pure-Perl XML tree parser and builder. It aims to implement 100% of the W3C XPath specification.

METHODS

new( $tree )

The constructor returns a new XPath parser for the given tree.

query( $path )

Returns a XML::Parser::Lite::Tree::XPath::Result object containing the result of the query.

select_nodes( $path )

A convinience function around query() which returns 0 unless the result is a nodeset, else returns the value of the nodeset.

AUTHORS

Copyright (C) 2004-2008, Cal Henderson <cal@iamcal.com>

SEE ALSO

XML::Parser::Lite::Tree