Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 contemplating the Monastery: (3)
As of 2015-07-07 04:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls