Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Contributor
Posts: 9
Registered: ‎05-09-2013
My Device: blackberry curve
My Carrier: 9970175907

how to add new node in existing xml file

Hi,

I am beginner in blackberry development . can any budy tell me how to append new node in existing xml file.

 

i have tried this code but its not working

 


NodeList list12=document.getElementsByTagName("*");
// Node value1=list12.item((list12.getLength()-1)).getChildNodes().item(0);
// node=list12.item((list12.getLength()-1)).getNodeName();
// element=value1.getNodeValue();
Dialog.alert(Integer.toString(list12.getLength()) );


Element newD = document.createElement("Details");

Element newM= document.createElement("MobileNo");
newM.appendChild(document.createTextNode("9890246286"));
newD.appendChild(newM);


Element NewName = document.createElement("Name");
NewName.appendChild(document.createTextNode("NwAnkit"));
newD.appendChild(NewName);

Element newInsurance = document.createElement("Insurance");
newInsurance.appendChild(document.createTextNode("NwInsurance"));
newD.appendChild(newInsurance);

Element Newmaker = document.createElement("maker");
Newmaker.appendChild(document.createTextNode("Nwmaker"));
// Newmaker.setTextContent("accident");
newD.appendChild(Newmaker);

Element newStardate = document.createElement("Startdate1");
newStardate.appendChild(document.createTextNode("19/19/19"));
newD.appendChild(newStardate);

Element newExpDate= document.createElement("ExpDate");
newExpDate.appendChild(document.createTextNode("18/18/18"));
newD.appendChild(newExpDate);







document.appendChild(newD);