I have an XML file and I am loading it in Xmldocument. This document has a node with some child nodes like this
you can use XLinq to modify XML document
Following is an example of xml modification
String xmlString = ""+""+
""+
" "+
" 1 "+ //1
" 2 "+ //2
" 3 "+ // 3, I need to insert it
" 4 "+ //4, I need to insert this second time
" 5 "+
" 6 "+
" "+
" "+
" ";
XElement root = XElement.Parse(xmlString);
var childrens = root.Descendants("children").ToArray();
var third = childrens[3];
var fourth = childrens[4];
third.AddBeforeSelf(new XElement("children"));
fourth.AddBeforeSelf(new XElement("children"));
var updatedchildren = root.Descendants("children").ToArray();