Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: XML::Simple add

by strat (Canon)
on Nov 27, 2007 at 07:53 UTC ( #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"


Comment on Re: XML::Simple add
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (12)
As of 2014-08-22 14:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (158 votes), past polls