my $parser = XML::Parser->new(ErrorContext => 2, Style => "Tree"); my $xso = XML::SimpleObject->new( $parser->parse($content) ) or die "could not parse!"; foreach my $form($xso->children()) { check_tag($form); } sub check_tag{ foreach my $tag($_[0]->children()) { print $tag->name." ".$tag->value."\n"; check_tag($tag); } }