<?xml versions="1.0"?> <spam-document version="3.5" timestamp="2001-05-13 15:33:45"> <!--Autegenarated by RAJPATIL--> <customer> <first-name>Raj</first-name> <surname>Patil</surname> <address> <street>4th block tajajinagar</street> <city>Bangalore</city> </address> <age>30</age> </customer> <customer> <first-name>Vedanth</first-name> <surname>R.Patil</surname> <address> <street>4th block tajajinagar</street> <city>Bangalore</city> </address> <age>2</age> </customer> </spam-document>
The Error message i got after running the script as: XML or text declaration not at start of entity at line 2, column 0, byte 1 at C: /Perl64/lib/XML/Parser.pm line 187 In order to work this script do i need to install the module manually or is there any error in sample script? Monks, help to fix the issue, so that i will continue my tour of xml with perl#!/usr/bin/perl -w use strict; use warnings; use XML::Simple; my $cust_xml = XMLin('./customers.xml',forcearray=>1); for my $customer(@{$cust_xml->{customer}}) { foreach (qw(first-name surname)) { $customer->{$_}->[0] = uc($customer->{$_}->[0]); } } print XMLout($cust_xml); print "\n";
In reply to Getting XML::Simple Module Error by perladdict
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |