Append child nodes to the existing xml file

Hi Experts,

Can you please help me in appending child nodes in the existing XML File. Here is my code. i don’t know where i went wrong. it doesn’t works for me

IF ISCLEAR(XmlDoc) THEN
CREATE(XmlDoc);
XmlDoc.async := FALSE;
XmlDoc.load(‘d:\newsample.xml’);
XmlDoc.loadXML:=’’;
locautXmlElem:=XmlDoc.documentElement;
xmlnode:=locautXmlElem.ownerDocument.createNode(‘element’,‘Header’,’’);
locautXmlElem.appendChild(xmlnode);

Thanks in Advance,

Reka.S

Hi All,

I have tried with the following code for appending the child elements and it works for me.

IF ISCLEAR(XmlDoc) THEN
CREATE(XmlDoc);
XmlDoc.load(‘d:\newxml.xml’);
xmlnode:=XmlDoc.documentElement;
locautXmlElem:=XmlDoc.createElement(‘Header’);
locautXmlElem.text:=‘19.95’;
xmlnode.appendChild(locautXmlElem);
XmlDoc.save(‘d:\Sample.xml’);

Regards,

Reka.S