Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The script paltform is C# winform,now i need edit a xml file.
i want move a xmlnode to his parent level,like below move B to the top of A:
A
|
X--|
B
but i try as "A.ParentNode.InsertBefore(B, A);", but failed.
And i had try to use "Clone" or "AppendChild" to A.parent then "InterBefore" to A, but all failed...:confused:


Whats the correct way? or there are some limits on differen level xlmnode moving within same xmldocument?
Posted

1 solution

You can try following.

XmlNode parent = currentNode.ParentNode;
//parent.RemoveChild(priusNode); 
//then use parent.InsertBefore method to move it.



HTH
 
Share this answer
 
Comments
Kean(cn) 21-Jul-10 1:55am    
I had try this method as post this question before, failed too.

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