Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to duplicate nmodes with all its child node and append it inside ExportedObjects node. Same goes for other notenode. Copy all child node of Type Node and append it

What I have tried:

...................
Posted
Updated 18-Dec-16 20:24pm
v8
Comments
David_Wimbley 9-Sep-16 8:30am    
When you say it "takse the node in memory" do you mean it makes it and stores only the node you are looking for? Then your issue is that you need to take that node from memory and put it back into the XML?

You need to take cloned element and add it to the node where you need it to be. It can be your root node, your outer OI node or another XML document. But you have to have node.Add (clonedNode) somewhere.

Also, consider using XPath to select OI node precisely, this LastChild.LastChild.LastChild creates structural dependancy and your code will break if someone adds even <br /> at the end of your XML.

Instead, select
C#
rootNode.SelectSingleNode("//ExportedObjects");
and work from there.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900