Creating XML::DOM Tags

Hi,

I am a newbie to XML-DOM. I have a peculiar problem in appending XML tags.
I am using Perl to work with XML. The Contents of the XML file is as
follows.

<XML_File>
<Data>
<Name>Mr. XYZ</Name>
<Address>Actual Address#1</Address>
</Data>

<Data>
<Name>Mr. ABC</Name>
<Address>Actual Address#2</Address>
</Data>
</XML_File>

I keyed in the above data in a file. Now how to actually create such tags
with values using perl scripts. I tried with
$Node = $Doc->getElementsbyTagName("XML_File")->item(0);
$DataNode = $Doc->createElement("Data")
$Node->appendChild($DataNode);

Now the above code is working and it created a instance of <Data></Data>.
But how to actually create tags under <Data>. I mean if i say 
getElementsbyTagName("Data"), Then i will get an multiple instance of
<Data>.I don't want to say getElementsbyTagName("Data")->item(0) b'coz
it would be very static. I want the DOM Parser to identify the last <Data>
instance that is created and it should return me so that i can do 
createElements under it.

Any suggestions/help would be great.

Thanks
guru.


  

Received on Monday, 20 November 2000 06:26:37 UTC