Mega Code Archive

 
Categories / C# Tutorial / XML
 

Show innter xml and outer xml from XPathNavigator

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Xml; using System.Xml.XPath;     public class MainClass     {         public static void Main()         {             XPathDocument doc=new XPathDocument(Application.StartupPath + @"\employees.xml");             XPathNavigator navigator = doc.CreateNavigator();             navigator.MoveToRoot();             navigator.MoveToFirstChild();             while (navigator.MoveToNext())             {                 MessageBox.Show(navigator.InnerXml);                 MessageBox.Show(navigator.OuterXml);             }         }     }