#!/usr/bin/perl -- use strict; use warnings; use Data::Dump; use XML::Rules; my $ta = XML::Rules->new( qw/ stripspaces 8 /, rules => { 'literal' => 'as is', 'binding' => 'as array no content', 'uri' => 'content', 'results' => 'no content' } ); my @xml = ( q{ Football.png Second article. }, q{ First article. } ); dd( my$ref = $ta->parsefile( \$_ )) for @xml; __END__ { results => { binding => [ { name => "image_url", uri => "Football.png" }, { literal => { "_content" => "Second article.", "xml:lang" => "en" }, name => "description", }, ], }, } { results => { binding => [ { literal => { "_content" => "First article.", "xml:lang" => "en" }, name => "description", }, ], }, }