Skip to content

Instantly share code, notes, and snippets.

@sween
Created December 8, 2009 15:36
Show Gist options
  • Save sween/251732 to your computer and use it in GitHub Desktop.
Save sween/251732 to your computer and use it in GitHub Desktop.
public static string GetNodeValue2(XPathDocument sdoc, string sSelectExpression)
{
string sRetVal = "";
// Read the XML document
//XPathDocument myXPathDocument = new XPathDocument(sFileName);
XPathNavigator myXPathNavigator = sdoc.CreateNavigator();
XPathNodeIterator myXPathNodeIterator = myXPathNavigator.Select(sSelectExpression);
while (myXPathNodeIterator.MoveNext())
{
//Console.WriteLine("<" + myXPathNodeIterator.Current.Name + "> " + myXPathNodeIterator.Current.Value);
sRetVal = myXPathNodeIterator.Current.Value;
}
return sRetVal;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment