in reply to perl script to print xml data like this
hai
i guess you can use the XML::LibXML for this
this would be the code
use XML::LibXML; $parser = XML::LibXML->new(); $serverxml = '1.xml'; my $doc= $parser->parse_file($serverxml); my $root = $doc->getDocumentElement; foreach my $file ($root->findnodes('/xml/DTC')){ $trblcode = $file->findvalue('./TroubleCode'); print "code --> ".$trblcode."\n"; $rem = $file->toString(); print "Rem--> ".$rem."\n"; }
Replies are listed 'Best First'. | |
---|---|
Re^2: perl script to print xml data like this
by veerubiji (Sexton) on Oct 04, 2011 at 09:21 UTC |
In Section
Seekers of Perl Wisdom