<table class="footable table" id="footable"> <tbody> <tr class="trclass red" data-index="123" data-name="Apple"> <td class="col1" >Green</td> <td class="col2" >1.25</td> </td></tr> </tbody> </table>
// @Nuget: HtmlAgilityPack using System; using System.Xml; using System.IO; using HtmlAgilityPack; public class Program { public static void Main() { var html = @"<html> <tbody> <table id=\'footable\'> <tr class=\'trclass red\' data-index=\'123\' data-name=\'Apple\'> <td class=\'col1\' >Green</td> <td class=\'col2\' > 1.25</td></tr> </table> </tbody></html>"; var htmlDoc = new HtmlDocument(); htmlDoc.LoadHtml(html); var tbody = htmlDoc.DocumentNode.SelectNodes("//table[contains(@id, 'foo')]//tr//td"); foreach(var nob in tbody) { Console.Write(nob.InnerHtml); } } }
<tr class=\'trclass red\' data-index=\'123\' data-name=\'Apple\'> <td class=\'col1\' >Green</td> <td class=\'col2\' > 1.25</td> </table>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)