insert a node in an existing element
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sachin_Patil
Posted On:   Sunday, November 18, 2001 08:59 PM

How do I insert a node in an existing element of the xml document? Like:



AAA



And I want to add a node which results like :




AAA
111



I am using jaxp.

Re: insert a node in an existing element

Posted By:   Bozidar_Dangubic  
Posted On:   Monday, November 19, 2001 07:22 AM

parse the document into DOM Document. find the Element row. using the original DOM document, create a new Element (doc.createElement("Num")), set its value to "111" and appendChild(new element) into "row" element. make sure you use original DOM Document's createElement() method since otherwise appendChild() will throw a hierarchy exception...

Re: insert a node in an existing element

Posted By:   Bozidar_Dangubic  
Posted On:   Monday, November 19, 2001 07:22 AM

parse the document into DOM Document. find the Element row. using the original DOM document, create a new Element (doc.createElement("Num")), set its value to "111" and appendChild(new element) into "row" element. make sure you use original DOM Document's createElement() method since otherwise appendChild() will throw a hierarchy exception...
About | Sitemap | Contact