Explain how XPathNavigator read data from an XMLDocument.
public void DoRead()
{
XPathNavigator myNavigator;
XPathDocument myDocument;
// Open the XML.
myDocument = new XPathDocument(@"c:\abc.xml");
myNavigator = myDocument.CreateNavigator();
myNavigator.MoveToRoot();
myNavigator.MoveToFirstChild();
if (myNavigator.NodeType == XPathNodeType.Element)
{
if (myNavigator.HasChildren == true)
{
myNavigator.MoveToFirstChild();
do
{
Console.Write("The XML string is ");
Console.WriteLine("is '{0}'", myNavigator.Value);
}
while (myNavigator.MoveToNext());
}
}
}