Here's an (untested) example:
use XML::Rules;
use Data::Dumper;
my %tag_value;
my $tag_name;
my $xr = XML::Rules->new(
rules => [ value => sub { $tag_value{$tag_name} = $_[1]->{_content}
+],
start_rules => [ 'summary,detail1,detail2' => sub { $tag_name = $_[0
+] } ],
);
$xr->parse($xml) # I left the xml out
print Dumper \%tag_value;
Note that this could be done much differently by passing the 'value' content up through the 'item' tag to the item's parent tag, returning the entire data structure. I'll leave that as an exercise...(Hint: use the 'content' rule for value and 'pass no content' for item tags, and 'no content by <attr>' for the other tags).