What's the best way to move "a child up" in a .NET XmlDocument?

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2010-03-13T03:28:30Z Indexed on 2010/03/13 4:17 UTC
Read the original article Hit count: 176

Filed under:
|

Given an XML structure like this:

<garage>
 <car>Firebird</car>
 <car>Altima</car>
 <car>Prius</car>
</garage>

I want to "move" the Prius node "one level up" so it appears above the Altima node. Here's the final structure I want:

<garage>
 <car>Firebird</car>
 <car>Prius</car>
 <car>Altima</car>
</garage>

So given the C# code:

XmlNode priusNode = GetReferenceToPriusNode()

What's the best way to cause the priusNode to "move up" one place in the garage's child list?

© Stack Overflow or respective owner

Related posts about c#

Related posts about Xml