Hi, Can anybody give me a simple code snippet which writes or modifies this xml ? <my_list> <guy name="SomeGuy"> <user>Tom</user> <date-of-birth>Aug 2006</date-of-birth> </guy> <guy name="AnotherGuy"> <user>Dicken</user> <date-of-birth>Aug 2006</date-of-birth> </guy> </my_list>
I want to read and write into this simple xml, basically changing the values or deleting them. After scanning through different XML modules I zeroed into XML::SimpleObject for reading.For reading I know how to do it.For writing I am struggling.I want to use XML::Writer. Any help greatly appreciated. Thanx, Alok use XML::Parser ; use XML::SimpleObject; use XML::Writer; use IO::File; my $xml = "Inventory.xml" ; my $parser = XML::Parser->new(ErrorContext => 2, Style => "Tree"); my $xso = XML::SimpleObject->new( $parser->parsefile($xml) ); # Reading an XML file foreach my $element ($xso->child("my_list")->children("guy")) { print " User: " . $element->child("user")->value . "\n"; print " Date of Birth: " . $element->child("date-of-birth")->value . "\n"; print "\n" ; } # Code for Writing into the above xml -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>