Anatoly Lubarsky

Logo
MSSQL, .NET, Design. Life and Music

Read XML Using XPathNavigator

Small schematic snippet that demonstrates best practices reading XML in C#. The code uses XPathNavigator to navigate through XML document. The use of XPathNavigator produces fast and readable implementation.


using System;
using System.Xml;
using System.Xml.XPath;

namespace Messaging
{
    public class MyCode
    {
        public MyCode() {}

        public void ImCallingYou()
        {
            XmlReader reader = new XmlTextReader("input.xml");
            XPathDocument doc = new XPathDocument(reader);
            XPathNavigator nav = doc.CreateNavigator();
            this.CallMe(nav);
        }


        public void CallMe(XPathNavigator yourstuff)
        {

        }
    }
}

Related Posts:

Saturday, January 10, 2004 6:31 AM

If your feedback doesn't appear right away, please be patient as it may take a few minutes to publish.

Post a Comment

Protected by CAPTCHAEnter the code you see
Name (*)  
E-mail (*)  
Url
Remember

Comment (*)