#!/usr/bin/perl -w ############### ## Libraries ## ############### use strict; use warnings; use XML::Simple qw{ :strict }; ################## ## User-defined ## ################## my $h_xml_args = { 'forcearray' => [ ], 'keyattr' => [ ], 'KeepRoot' => 1, }; ################## ## Main program ## ################## chomp(my @xml = ); my $xml = join("\n", @xml); # Read and display the input XML print "[Input XML]\n"; print "-" x 79, "\n"; for (my $i = 0; $i < @xml; $i++) { printf " %3d. %s\n", $i+1, $xml[$i]; } print "-" x 79, "\n\n"; # Parse the XML with XML::Simple my $h_xml = eval { XMLin($xml, %$h_xml_args) }; if ($@) { die "Error while parsing XML:\n$@\n"; } __DATA__ notification 1972308645 processed
Example of XML::Simple
The error: no closing "/ERROR" tag More info Still more info And so on ...