Using C# I would like to know how to get the Textbox value (i.e: john) from this sample html script :
-
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(html);
XPathNavigator docNav = doc.CreateNavigator();
XPathNavigator node = docNav.SelectSingleNode("//td/input/@value");
if (node != null)
{
Console.WriteLine("result: " + node.Value);
}
I wrote this pretty quickly, so you'll want to do some testing with more data.
NOTE: The XPath strings apparently have to be in lower-case.
EDIT: Apparently the beta now supports Linq to Objects directly, so there's probably no need for the converter.
- 热议问题