Hi,
I am trying to insert new child nodes
which contain n no of child nodes in them
eg:
<filename>
<line no=1>
<code user= a>This is the code </code>
</line>
</filename>
adding new child node would be like this
eg:
<filename>
<line no="1">
<code user= "a">This is the code </code>
</line>
<line no=2>
<code user= "a">This is the code for line 2</code>
<code user= "b">This is the new code for line 2</code>
<code user= "b">This is another code for line 2</code>
</line>
</filename>
but when I try to create a new line node
it is getting created as
<line no = "1"/>
hence the children <code> tags are not getting appended
heres the code:
for (int i = 0; i < files.getLength(); i++) {
Element file = (Element) files.item(i);
if (file.getAttribute("name").equals("newfile")) {
Element linenode = customerDom.createElement("line");
linenode.setAttribute("no", "600");
Element codenode = customerDom.createElement("code");
codenode.setAttribute("user", "a");
codenode.setNodeValue("This is the code for line 2");
linenode.appendChild(codenode);
Element codenode2 = customerDom.createElement
("code");
codenode2.setAttribute("user", "b");
codenode2.setNodeValue("This is the new code for line
2");
linenode.appendChild(codenode2);
file.appendChild(linenode);
}
}
Please let me know where I am wrong....
Thanks,
Komal
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.