i need to insert a new element in an existing xml document.This is my sample xml document..
I'll get get the node name that has to be and its value and the position to add the node all in run time only.
I'm displaying the xml in a form display in a jsp page and i have a check box for every node. So when i click a node i'll display the elements that can be added under that corresponding node using the DTD of that xml.
Hereby i'm getting the node name its textvalue and Xpath..
I couln't get the xpath correctly and so i couln't add that element in the proper node.
Here is my code....
It adds the node name and node value but not in the correct location...It adds under the first <person> even if i select second <person>
i'm going wrong in the nodepath as i'm retrieving the nodepath as "/folks/person/name".. it cant identify the exact <person> and so it considers the first <person>