Click here to Skip to main content
15,885,757 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
|
C

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...


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

1 solution

try the following:

Clone the B node in a new XMLNode.
Remove the old one(B).
Then insert the new one, before the desired one.
 
Share this answer
 
Comments
Kean(cn) 21-Jul-10 1:57am    
I did this before got there, 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