in reply to Append in XML using perl
It would probably help if you were to give us a tiny example of what you are trying to do, but using XML::DOM adding and deleting nodes is really quite easy:
The above adds a <Thing /> within the <Things /> node and removes all the <BadThings />use XML::DOM; my $xml =<<EOXML; <Stuff> <Things> <Thing /> <Thing /> </Things> <BadThing /> </Stuff> EOXML my $parser = new XML::DOM::Parser; my $doc = $parser->parse($xml); my $things = $doc->getElementsByTagName ("Things")->[0]; my $newthing = $doc->createElement('Thing'); $things->appendChild($newthing); my $badthings = $doc->getElementsByTagName ("BadThing"); foreach $badthing ( @{$badthings} ) { $doc->getDocumentElement()->removeChild($badthing); } print $doc->toString();
/J\
|
|---|