Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wrapping xml node in another node!

Status
Not open for further replies.

FOR111

Programmer
Sep 29, 2005
103
MT
Hi All,

I have an xml document received from a webservice as a string. I then have a method which makes string to an xml dom document. The structure is as follows:

Code:
 <?xml version="1.0" encoding="utf-8" ?> 
 <Download ...>
   <element1>XXX</element1>
   <element2>YYY</element2>
 </Download>

Now, i would like to wrap the node <Download></Download> within another Node..eg:

Code:
 <?xml version="1.0" encoding="utf-8" ?> 
 <DownloadArray ...> 
  <Download>
   <element1>XXX</element1>
   <element2>YYY</element2>
  </Download>
 </DownloadArray>

How can i do this using the Dom XMl utilities?


Thanks
Nick
 
1) Look at the DOM APIs - they can be helpful.

2) Create a new DOM object, add a root node, then add a child to that root node, which is the desired node of your source DOM object.

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top