<?xml version= "1.0" encoding= "Utf-8"?><employees> <employee on= > <name>Tom</name> <sex> men </sex> <birth> <year>1982</year> < month>5</month> <day>22</day> </birth> < sales> <year>2010</year> <month>1</month> <sale>320000</sale> </sales> <salary>8600</salary > </employee> <employee on= "to" > <name>Jack</name> <sex> men </sex> <birth> <year>1981</year> <month>7</month> <day>10</day> </ birth> <sales> <year>2010</year> <month>1</month> <sale>300000</sale> </sales> <salary>6000</salary> </employee> <employee on= " "> <name>Jennifer</name> <sex> women </sex> <birth > <year>1982</year> <month>6</month> & nbsp <day>22</day> </birth> <sales> <year>2010 </year> <month>1</month> <sale>500000</sale> </sales> <salary>7000</salary> </employee> < /employees>=============================================================using System;using System.collections.generic;using system.linq;using system.web;using system.web.ui;using SysTem. Web.ui.webcontrols;using system.xml.xpath;namespace webapplication{ Public partial class Xpathnav: system.web.ui.page { protected void Page_Load (object sender, EventArgs e) &N Bsp { } protected void Btnnav_click (object sender, Eventar GS e) { //Create XPathDocument object XPathDocument Xdoc = new XPathDocument (Server.MapPath ("~/employees.xml")); & nbsp //Create XPath navigation XPathNavigator xnav = Xdoc. CreateNavigator (); //Loading iterators (results) Xpathnode Iterator Iterator = Xnav. Select ("Descendant::employee"); String outPut = "; while (iTerator. MoveNext ()) { OutPut + = "Employees:" + iterator. Current.selectsinglenode ("name"). Value+ "<br/>"; Look for a single node under the current node name value OutPut + = "+" Salary: "+ iterator. Current.selectsinglenode ("Salary"). Value + "<br/>"; Find the value of single node salary under current node OutPut + = "
XPath related notes