20 Sep 2004 02:17:51 UTC
- Distribution: XML-Parser-Lite-Tree-XPath
- Module version: 0.02
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (1)
- Testers (6 / 5 / 1)
- KwaliteeBus factor: 0
- License: unknown
- Activity24 month
- Download (8.75KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
XML::Parser::Lite::Tree::XPath - XPath access to XML::Parser::Lite::Tree trees
use XML::Parser::Lite::Tree; use XML::Parser::Lite::Tree::XPath; my $xpath = new XML::Parser::Lite::Tree::XPath($tree); my @nodes = $xpath->select_nodes('/photoset/photos');
This module offers limited XPath functionality for
XML::Parser::Lite::Treeobjects. For more information about XPath see http://www.zvon.org/xxl/XPathTutorial/General/examples.html
XML::Parser::Lite::Tree::XPathobject for the given tree.
Sets the tree for the object.
Returns an array of nodes for the given XPath.
The child axis is used by default. The following rules are equivilent:
The following axes are supported:
ancestor ancestor-or-self child descendant descendant-or-self following following-sibling preceding preceding-sibling parent self
But these axes are not supported:
Only a handful of the XPath functions are implemented. If you need further functions, send the author a test case and he'll try and implement them.
The following functions are supported:
last() not() normalize-space() count() name() starts-with() contains() position() string-length() floor() ceiling()
But these functions are not currently supported:
id() string() concat() substring_before() substring_after() substring() translate() boolean() true() false() lang() number() sum() round() x_lower() x_upper() generate_id()
In addition to the unsupported functions and axes, several XPath features are also unsupported.
* attribute fetching * relative paths
Sub-rules are evaluated in a boolean context, except in the case where a subrule is a simple integer (e.g.
//foo). This has some odd side effects - the
last()function returns a boolean specifying whether the element is the last in the set or not. To get the sequence number of the last element in a set (e.g.
//foo[position() = last()]), use the
last-id()function instead. If you need to do some sort of caclulation which would return a position (e.g.
//foo[1+1]), then compare the value using the
position()function to get the correct result (e.g.
//foo[1+1 = position()]).
Copyright (C) 2004, Cal Henderson, <firstname.lastname@example.org>
Module Install Instructions
To install XML::Parser::Lite::Tree::XPath, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install XML::Parser::Lite::Tree::XPath
For more information on module installation, please visit the detailed CPAN module installation guide.