in reply to Parsing semi-complex HTML
With XML::LibXML, it would be
for my $node ($doc->findnodes('//*[@class="className"]')) { print($node->toString()); }
If you want to use HTML::Parser (e.g. if the HTML isn't valid), don't use it directly. Use HTML::TreeBuilder instead. It creates a tree of HTML::Element objects, whose look_down and as_HTML method you could use.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parsing semi-complex HTML
by duelafn (Parson) on Jul 07, 2010 at 15:57 UTC | |
by ikegami (Patriarch) on Jul 07, 2010 at 16:11 UTC | |
by Your Mother (Archbishop) on Jul 07, 2010 at 16:30 UTC | |
by ikegami (Patriarch) on Jul 07, 2010 at 16:40 UTC |