Praveen - the first and second part of your question don't seem to relate,
but i'll assume you mean find the table element that has a child user
element (which contains username and password child elements) with the text
"pqr". Correct?
Here is a quick sample - let me know if you need anything more.
XPathDocument myXPathDocument = new XPathDocument("mydocUrl.xml");
XPathNavigator myXPathNavigator = myXPathDocument.CreateNavigator();
string xpathexpr = "/table[username::text()='pqr']";
//string xpathexpr = "/table[username/text()='pqr']";
XPathNodeIterator myXPathNodeIterator = myXPathNavigator.Select
(xpathexpr);
while (myXPathNodeIterator.MoveNext())
{
Console.WriteLine("<" + myXPathNodeIterator.Current.Name + "> " +
myXPathNodeIterator.Current.Value);
}
Console.WriteLine();
Steven
Founder,
http://venturetogether.com
"Praveen Naregal" <pg*******@hotmail.com> wrote in message
news:e7**************@TK2MSFTNGP09.phx.gbl...
Hi all,
I have a xml document like this.
<table>
<username>xyz</username>
<password>abc</password>
</table>
<table>
<username>pqr</username>
<password>mnp</password>
</table>
How can I point to node username where user is "pqr"? Subsequently load
all the childnoes in a nodelist. A bit of C# code will be helpful.
Thanks in advance for the help .
Praveen Naregal