Hello,
I'm trying to execute a simple Perl program that uses XML::Simple to print out the data from an XML file. However, the error I'm getting is :
no element found at line 15, column 0, byte 308 at /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/XML/Parser.pm line 185
The XML file is as follows :
<?xml version="1.0"?>
<customer-data>
<customer>
<first_name>Frank</first_name>
<last_name>Sanbeans</last_name>
<dob>3/10</dob>
<email>[email protected]</email>
</customer>
<customer>
<first_name>Sandy</first_name>
<last_name>Sanbeans</last_name>
<dob>4/15</dob>
<email>[email protected]</email>
</customer>
And, my perl code is :
use strict;
use XML::Simple;
my $xml = XMLin('./test.xml',forcearray => 1);
foreach my $customer (@{$xml->{customer}}) {
print "Name: $customer->{first_name}->[0] ";
print "$customer->{last_name}->[0]\n";
print "Birthday: $customer->{dob}->[0]\n";
print "E-mail Address: $customer->{email}->[0]\n";
}
How can this be fixed ?
Thank You.