#!/usr/bin/perl use HTML::Tidy; use XML::XPath; use strict; use warnings; my $body; while(my $line = ) { $body .= $line; } my $tidy = HTML::Tidy->new({output_xml => 1,numeric_entities=>1}); my $clean = $tidy->clean($body); my $parser = XML::XPath->new(xml => $clean); my $set = '//p/a'; my $nodes = $parser->find($set); foreach my $node ($nodes->get_nodelist) { print "\n"; print $node->getName(),"\n"; # this next line is wrong print join(", ", $node->getAttributeNodes),"\n"; } exit(0); __DATA__ test

test heading

paragraph one one example.

paragraph two another example.