简体   繁体   English

解析或提取html表的内容

[英]Parsing or Extracting the content of html table

Can I parse the html tables by giving only column name ? 我可以仅给出列名来解析html表吗?

Like only those data should be extracted from the table which matches those column names I give. 就像只有那些数据应该从与我给出的列名匹配的表中提取一样。

Like for example I have table of column names like serial no., name, address, phone no,total Rs.. 例如,我有列名称表,例如序列号,名称,地址,电话号码,总卢比。

And I want to extract the information about only name, phone no and total Rs.. Then how can I do it? 我想提取有关姓名,电话号码和总卢比的信息。那么我该怎么办?

看一下HTML Agility Pack它提供了一个LINQ api,用于搜索html内容。

Yes you can. 是的你可以。 You can use XPATH to scan your html document (google for screen scraping). 您可以使用XPATH扫描html文档(Google用于屏幕抓取)。 Another technique is UI testing frameworks like Watin which let you use CSS selectors and more to find elements on a HTML page and get the contents. 另一种技术是UI测试框架(如Watin),该框架使您可以使用CSS选择器等来在HTML页面上查找元素并获取内容。

您可以使用具有HtmlProcessor类和Tables属性的Data Extracting SDK ,该属性将HTML表作为DataTable对象处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM