Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: perl script to print xml data like this

by ym_chaitu (Initiate)
on Oct 04, 2011 at 05:56 UTC ( #929444=note: print w/ replies, xml ) Need Help??


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"; }


Comment on Re: perl script to print xml data like this
Download Code
Re^2: perl script to print xml data like this
by veerubiji (Sexton) on Oct 04, 2011 at 09:21 UTC

    Hi, Thanks for reply,I tried your code but its doesn't print any thing frist some errors occured, that errors or globle symbol $parser requires explicts package name like that. i cleared by declaring my $parser like that. but still nothing is printing. it shows process started and finished.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://929444]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2014-12-18 09:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (48 votes), past polls