p1 p2 c1_1 p3 c2 p4 c1_2 p5 #### 'root' => { 'parent' => [ { 'text' => 'p1 p2 p3 p4 p5' 'ch2' => [ 'c2' ], 'ch1' => [ 'c1_1', 'c1_2' ] } ] } #### my $parser = XML::Rules->new ( rules => [ root => 'no content', parent => 'no content array', ch1 => 'content array', ch2 => 'content array', ] ); my $result = $parser->parsestring($xml); #### # different Rule for "parent" parent => sub {$_[0]->{text} => $_[1]->{_content}},