Hi,
I am using the below code to search GATE=1 from the xml file but not
getting the output.How to do it?I want to display the contents of GATE=1
in my console application.How to query that particular gate in c#.net?
XPathDocument doc = new XPathDocument("C:\\gates.xml");
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator iterator = nav.Select("/ITPL/GATE/@NAME='1'");
while (iterator.MoveNext())
{
Console.WriteLine(iterator.Current.Name);
--------------------------------------------------------------------
<ITPL>
<GATE NAME='2'>
<Slot sno='5'>slot no=5, type=4,VACANT</Slot>
<Slot sno='6'>slot no=6, type=4,VACANT</Slot>
<Slot sno='7'>slot no=7, type=2,VACANT</Slot>
<Slot sno='8'>slot no=8, type=4,VACANT</Slot>
</GATE>
<GATE NAME='1'>
<Slot sno='1'>slot no=1, type=4,VACANT</Slot>
<Slot sno='2'>slot no=2, type=2,VACANT</Slot>
<Slot sno='3'>slot no=3, type=4,VACANT</Slot>
<Slot sno='4'>slot no=4, type=2,VACANT</Slot>
</GATE>
<GATE NAME='3'>
<Slot sno='9'>slot no=10, type=2,VACANT</Slot>
<Slot sno='10'>slot no=11, type=2,VACANT</Slot>
<Slot sno='11'>slot no=12, type=2,VACANT</Slot>
<Slot sno='12'>slot no=13, type=4,VACANT</Slot>
</GATE>
</ITPL>
--
Message posted via http://www.dotnetmonster.com