Skip to main content
The link was going to some weird page in chinesse http://dfltweb1.onamae.com/
Source Link
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: There's also the Html Agility Pack to LINQ to XML Converter - I haven't tried this one yet.

EDIT: Apparently the beta now supports Linq to Objects directly, so there's probably no need for the converter.

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: There's also the Html Agility Pack to LINQ to XML Converter - I haven't tried this one yet.

EDIT: Apparently the beta now supports Linq to Objects directly, so there's probably no need for the converter.

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.

Added note
Source Link
TrueWill
  • 25.7k
  • 11
  • 105
  • 156
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: There's also the Html Agility Pack to LINQ to XML Converter - I haven't tried this one yet.

EDIT: Apparently the beta now supports Linq to Objects directly, so there's probably no need for the converter.

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: There's also the Html Agility Pack to LINQ to XML Converter - I haven't tried this one yet.

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: There's also the Html Agility Pack to LINQ to XML Converter - I haven't tried this one yet.

EDIT: Apparently the beta now supports Linq to Objects directly, so there's probably no need for the converter.

Added hyperlink
Source Link
TrueWill
  • 25.7k
  • 11
  • 105
  • 156
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: There's also the Html Agility Pack to LINQ to XML Converter - I haven't tried this one yet.

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.

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: There's also the Html Agility Pack to LINQ to XML Converter - I haven't tried this one yet.

Source Link
TrueWill
  • 25.7k
  • 11
  • 105
  • 156
Loading