开发者

Can Perl's HTML::Selector::XPath be used for the general purpose of finding XPaths?

Can Perl's HTML::Selector::XPath be used for the general purpose of finding XPaths?

  use HTML::Selector::XPath;

  my $selector = HTML::Selector开发者_如何学JAVA::XPath->new("li#main");
  $selector->to_xpath; # //li[@id='main']

  # functional interface
  use HTML::Selector::XPath 'selector_to_xpath';
  my $xpath = selector_to_xpath('div.foo');


HTML::Selector::XPath takes a CSS selector and converts it to an equivalent XPath expression. It doesn't let you search an HTML file for matching elements. Maybe you're looking for HTML::TreeBuilder::XPath or HTML::Query.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜