Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: XML::Simple add

by strat (Canon)
on Nov 27, 2007 at 07:53 UTC ( [id://653167]=note: print w/replies, xml ) Need Help??


in reply to XML::Simple add

I would use XML::DOM for it, e.g.

use XML::DOM; my $file = 'file.xml'; my $xmlParser = XML::DOM::Parser->new; my $xmlDocument = $xmlParser->parsefile( $file ) or die ....; # get parent node my $nodes = $xmlDocument->getElementsByTagName( 'exec' ); my $parentNode = $nodes->item( 0 ) or die "No node with id 0 available\n"; my $newChild = $xmlDocument->createElement('tc'); $newChild->setAttribute( id => '12346' ); $parentNode->appendChild( $newChild ); print $xmlDocument->toString; # debug $xmlDocument->printToFile( $outputfilename) or die ...; $xmlDocument->dispose;

(Not tested)

Best regards,
perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-04-19 14:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found