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;
publicclass MainClass
{
publicstaticvoid Main()
{
XPathDocument doc=new XPathDocument(Application.StartupPath + @"\employees.xml");
XPathNavigator navigator = doc.CreateNavigator();
XPathNavigator result=navigator.SelectSingleNode(@"employees/employee[@employeeid=1]");
result.MoveToFirstChild();
do
{
switch (result.Name)
{
case "firstname":
Console.WriteLine(result.Value);
break;
case "lastname":
Console.WriteLine(result.Value);
break;
case "homephone":
Console.WriteLine(result.Value);
break;
case "notes":
Console.WriteLine(result.Value);
break;
}
}
while (result.MoveToNext());
}
}