<?xml version="1.0" encoding="windows-1252"?>
<IDList><Details><id>Trial ID</id><name>Mooza
</name></Details><Details><id>Trial ID</id><name>bin_salim99
</name></Details><Details><id>Trial ID</id><name>dino88
</name></Details><Details><id>Trial ID</id><name>al3neeeeed
</name></Details><Details><id>TrialID</id><name>Do0oDa</name></Details
+></IDList>
In this I want to add a new node in the last or want to edit the note or delete the node.
I have read the values from the text file and write it in to xml. the code is
use XML::Writer;
use XML::XPath;
use XML::XPath::Node;
use IO::File;
open(NEW, "<<../main/idno.txt");
@id = <NEW>;
close (NEW);
my $output = new IO::File(">data9.xml");
my $doc = XML::Writer->new(OUTPUT => $output);
$doc->xmlDecl("windows-1252");
$doc->startTag("IDList");
foreach (@id)
{
($actid, $name) = split(/:/, $_);
$doc->startTag( "Details" );
$doc->dataElement( id => $actid);
$doc->dataElement( name => $name);
$doc->endTag("Details");
}
$doc->endTag("IDList"); # close IDList
$doc->end(); # final checks
$output->close();
Now I want to add a new child in the xml file or edit a node or delete the node. How i can do it and give some suggestions for that. If have any code send it.
|