in reply to Re^2: extracting data from HTML
in thread extracting data from HTML

If I understand you right, the (undocumented) "prefix" option already does that.

Replies are listed 'Best First'.
Re^4: extracting data from HTML
by tobyink (Canon) on Jun 06, 2012 at 22:17 UTC

    Indeed - it was me who requested this feature, and supplied the patch. Mostly in order to support XML::LibXML::QuerySelector, which extends XML::LibXML to support CSS selectors...

    my @important_paragraphs = $xmlnode->querySelectorAll('body p.important');

    XML::LibXML::QuerySelector passes the selector on to Corion's module, which returns it an XPath. It then queries XML::LibXML for the XPath, then passes the list of the results through a "descendent of" function to make sure that all returned elements are children of the original $xmlnode.

    TL;DR: XML::LibXML::QuerySelector implements W3C Selectors API Level 1 for XML::LibXML.

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'