Hi all,
'm trying to parse a simple xml document as below..

--------

#!/usr/bin/perl -w
use strict;
# use module

use XML::Simple;
use Data::Dumper;

# create object
my $config = XMLin('data.xml');

# print output
#print Dumper($config);

# access XML data
foreach $e (@{$config->{employee}})
{
        print $e->{name}, "\n";
        print "Age/Sex: ", $e->{age}, "/",  $e->{sex}, "\n";
        print "Department: ", $e->{department}, "\n";
        print "\n";
}

----------Whats wrong here?? ---

My xml file looks like,

<?xml version="1.0" encoding="UTF-8"?>
<employees>
<employee>
       <name>John Doe</name>
       <age>43</age>
       <sex>M</sex>
       <department>Operations</department>
</employee>
<employee>
       <name>John Doe1</name>
       <age>43</age>
       <sex>M</sex>
       <department>Operations123</department>
</employee>
</employees>

any pointes will be really good.

Regards

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to