大佬教程收集整理的这篇文章主要介绍了c# – 如何在HtmlAgilityPack中逐个元素地获取,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
html页面示例
<table> <tr> <td class="padding5 sorTing_1"> <span class="DateHover">01.03.14</span> </td> <td class="padding5 sorTing_1"> <span class="DateHover" >10.03.14</span> </td> </tr> </table>
我使用HtmlAgilityPack无效的代码
private static String GetDataByIClass(String HtmlIn,String ClassToGet) { HtmlAgilityPack.HtmlDocument DocToParse = new HtmlAgilityPack.HtmlDocument(); DocToParse.LoadHtml(HtmlIn); HtmlAgilityPack.HtmlNode InputNode = DocToParse.GetElementbyId(ClassToGet);//here is the problem i dont have method DocToParse.GetElementbyClass if (InputNode != null) { if (InputNode.Attributes["value"].Value != null) { return InputNode.Attributes["value"].Value; } } return null; }
母猪我需要读取此数据以获取日期01.03.14和10.02.14,以便能够将其保存到数组列表(然后再保存到xml文件)
播下任何想法我怎么能得到这个日期(01.03.14和10.02.14)?
以上是大佬教程为你收集整理的c# – 如何在HtmlAgilityPack中逐个元素地获取全部内容,希望文章能够帮你解决c# – 如何在HtmlAgilityPack中逐个元素地获取所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。