Insert after : Xml Node : XML C# Examples


C# Examples » XML » Xml Node »

 

Insert after









    
using  System;
using  System.Xml;

class  MainClass
{
    static  void  Main(string[]  args)
    {
                XmlDocument  xmlDoc  =  new  XmlDocument();
                xmlDoc.Load(@"c:\\books.xml");
                
                XmlDocumentFragment  xmlDocFragment  =  xmlDoc.CreateDocumentFragment();
                xmlDocFragment.InnerXml="<F><S>Data</S></F>";

                XmlNode  aNode  =  xmlDoc.DocumentElement.FirstChild;
                aNode.InsertAfter(xmlDocFragment,  aNode.LastChild);

                xmlDoc.Save(Console.Out);
        }              
  
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo XML
» Xml Node