Jan Kucera wrote:
I have XmlDocument, two XmlNodes and I want to swap them in the
document... how to do that?
Try
XmlNode sibling = xmlNode1.NextSibling;
if (sibling != null) {
xmlNode2.ParentNode.InsertBefore(xmlNode1, xmlNode2);
sibling.ParentNode.InsertBefore(xmlNode2, sibling);
}
else {
XmlNode parent = xmlNode1.ParentNode;
xmlNode2.ParentNode.InsertBefore(xmlNode1, xmlNode2);
parent.AppendChild(xmlNode2);
}
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/