PROXY  WHOIS  RQUOTE  TEXTS  SOFT  FOREX  BBOARD
 Music  Philosophy  Code  Literature  Russian

= ROOT|Technical|Code_Examples|Perl|site_perl|Class|XPath.pm =

page 6 of 7



=item parent/child/grandchild

Selects a list of grandchildren for all children of all parents.

=item parent[1]/child[2]

Selects a single child by indexing into the children lists.

=item parent[-1]/child[0]

Selects the first child of the last parent.  In the real XPath they
spell this 'parent[last()]/child[0]' but supporting the Perl syntax is
practically free here.  Eventually I'll support the XPath style too.

=item ../child[2]

Selects the second child from the parent of the current node.
Currently .. only works at the start of an XPath, mostly because I
can't imagine using it anywhere else.

=item child[@id=10]

Selects the child node with an 'id' attribute of 10.

=item child[@id>10]

Selects all the child nodes with an 'id' attribute greater than 10.
Other supported operators are '<', '<=', '>=' and '!='.

=item child[@category="sports"]

Selects the child with an 'category' attribute of "sports".  The value
must be a quoted string (single or double) and no escaping is allowed.

=item child[title="Hello World"]

Selects the child with a 'title' child element whose content is "Hello World".
The value must be a quoted string (single or double) and no escaping is allowed.
e.g.

 <child>
   <title>Hello World</title>
 </child>

=item //title[.="Hello World"]

Selects all 'title' elements whose content is "Hello World".

=item child/@attr

Returns the list of values for all attributes "attr" within each child.

=item //@attr

Returns the list of values for all attributes "attr" within each node.

=back

B<NOTE:> this module has no support for Unicode.  If this is a problem
for you please consider sending me a patch.  I'm certain that I don't
know enough about Unicode to do it right myself.

=head1 BUGS

I know of no bugs in this module.  If you find one, please file a bug
report at:

  http://rt.cpan.org

Alternately you can email me directly at sam@tregar.com.  Please
include the version of the module and a complete test case that
demonstrates the bug.

=head1 TODO

Planned future work:

=over

=item *

Support more of XPath!

=item *

Do more to detect broken get_* functions.  Maybe use Carp::Assert and
a special mode for use during development?

=back

=head1 ACKNOWLEDGMENTS

I would like to thank the creators of XPath for their fine work and
the W3C for supporting them in their efforts.

The following people have sent me patches and/or suggestions:

  Tim Peoples
  Mark Addison
  Timothy Appnel
=6=

1|2|3|4|5| < PREV = PAGE 6 = NEXT > |7

UP TO ROOT | UP TO DIR | TO FIRST PAGE

Google
 


E-mail Facebook Google Digg del.icio.us BlinkList Fark Furl Ma.gnolia Netscape NewsVine Reddit Slashdot Spurl StumbleUpon Technorati YahooMyWeb LiveJournal Blogmarks TwitThis Live News2.ru BobrDobr.ru Memori.ru MoeMesto.ru

0.00623703 wallclock secs ( 0.01 usr + 0.00 sys = 0.01 CPU)