James G Smith > Gestinanna-0.02 > Gestinanna::XSM::Expression::Parser

Download:
Gestinanna-0.02.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Source  

^

Data::DPath::Parser - Parses the DPath subset used by Data::DPath

SYNOPSIS ^

   use Data::DPath::Parser;

   my $result = Data::DPath::Parser->parse( $xpath );

   $result -> evaluate( $root, $context );

   $sub = $result -> compile;
   $sub -> ( $root, $context );

DESCRIPTION ^

Some notes on the parsing and evaluation:

DPath Expressions ^

DPath is based on XPath, but has some subtle (or not-so-subtle) differences.

Axis

DPath makes use of the following axis:

ancestor
ancestor-or-self
attribute

Eventually (with Perl 6), we will be able to support arbitrary attributes tied to data objects. But until then, only the following attributes are supported:

can
 Example: //*[@can="print" and @can="read"]

This will find all the nodes that have print and read methods.

defined
 Example: /foo[@defined]

Returns the object foo in the root of the context if it is defined.

isa
 Example: //*[@isa="Apache::Upload"]

This will find all the nodes in the context that are Apache::Upload objects.

size
version
child

This forces the identifier to be a child of a node. A child may be a hash key or an array index, depending on the parent node type. It will not be a method.

descendant
descendant-or-self
following
following-sibling
method

This forces the identifier to be a method of an object.

namespace
parent
preceding
preceding-sibling
self