Using org.w3c.dom package I have written code to generate .xml file. i.e.
<?xml version="1.0" encoding="UTF-8"?>
<Users>
<User>
<FirstName>Peter</FirstName>
<LastName>Johnson</LastName>
<UserName>peter</UserName>
<Password>1234567</Password>
<Email>peter@petersdomain.com</Email>
</User>
</Users>
The data for the xml file comes from a HTML Form. Everytime I submit the HTML Form, the data in the xml file is over-written by the new data.
What I want is that everytime I submit the HTML Form, the new data should be added and the old data should also exist. Can someone please tell me the solution. Here are few of the line of code;
Element main,root,item;
main = doc.createElement("Users");
main.appendChild(doc.createTextNode("\n"));
root = doc.createElement("User");
root.appendChild(doc.createTextNode("\n"));
item = doc.createElement("FirstName");
item.appendChild(doc.createTextNode(first_name));
root.appendChild(item);
root.appendChild(doc.createTextNode("\n"));
item = doc.createElement("LastName");
item.appendChild(doc.createTextNode(last_name));
root.appendChild(item);
root.appendChild(doc.createTextNode("\n"));
Thanks
[ July 12, 2005: Message edited by: Joseph Bashir ]
<?xml version="1.0" encoding="UTF-8"?>
<Users>
<User>
<FirstName>Peter</FirstName>
<LastName>Johnson</LastName>
<UserName>peter</UserName>
<Password>1234567</Password>
<Email>peter@petersdomain.com</Email>
</User>
</Users>
The data for the xml file comes from a HTML Form. Everytime I submit the HTML Form, the data in the xml file is over-written by the new data.
What I want is that everytime I submit the HTML Form, the new data should be added and the old data should also exist. Can someone please tell me the solution. Here are few of the line of code;
Element main,root,item;
main = doc.createElement("Users");
main.appendChild(doc.createTextNode("\n"));
root = doc.createElement("User");
root.appendChild(doc.createTextNode("\n"));
item = doc.createElement("FirstName");
item.appendChild(doc.createTextNode(first_name));
root.appendChild(item);
root.appendChild(doc.createTextNode("\n"));
item = doc.createElement("LastName");
item.appendChild(doc.createTextNode(last_name));
root.appendChild(item);
root.appendChild(doc.createTextNode("\n"));
Thanks
[ July 12, 2005: Message edited by: Joseph Bashir ]