$xpath = selector_to_xpath($selector, %options);
Shortcut for HTML::Selector->new(shift)->to_xpath(@_). Exported upon request.
$sel = HTML::Selector::XPath->new($selector, %options);
Creates a new object.
Returns the translated XPath expression. You can optionally pass root parameter, to specify which root to start the expression. It defaults to /.
The optional prefix option allows you to specify a namespace prefix for the generated XPath expression.
parse_pseudo This method is called during xpath construction when we encounter a pseudo selector (something that begins with comma). It is passed the selector and a reference to the string we are parsing. It should return one or more xpath sub-expressions to add to the parts if the selector is handled, otherwise return an empty list.
This module doesnt validate whether the original CSS Selector expression is valid. For example,
is an invalid CSS selector (class names should not begin with numbers), but this module ignores that and tries to generate an equivalent XPath expression anyway.
Tatsuhiko Miyagawa 2006-2011
Max Maischein 2011-
Tatsuhiko Miyagawa <email@example.com>
Most of the logic is based on Joe Hewitts getElementsBySelector.js on <http://www.joehewitt.com/blog/2006-03-20.php> and Andrew Duponts patch to Prototype.js on <http://dev.rubyonrails.org/ticket/5171>, but slightly modified using Aristotle Pegaltzis CSS to XPath translation table per <http://plasmasturm.org/log/444/>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|perl v5.20.3||HTML::SELECTOR::XPATH (3)||2012-01-16|