繁体   English   中英

如何从 HTML 页面源中获取特定的 html div 标签?

[英]How to get particular html div tags from a HTML page source?

Im using Asp.net and C# and im able to get the source code of a HTML page using webrequest and webresponse in a text file, now i want to get only some elements or html tags instead of whole source code, can any 1 help me in this ?? 如果可能的话,我们可以将元素和值保存在 mysql 数据库中。 建议是否有任何有用的参考链接?

查看HTML 敏捷包

您需要将 HTML 与正则表达式匹配,然后将结果保存到所需位置。

请参阅: http://haacked.com/archive/2004/10/25/usingregularexpressionstomatchhtml.aspx

这是一个完整的教程,但链接提供了您当前询问的主题,也应该有一些示例

http://www.tizag.com/htmlT/htmldiv.php

<div id="menu" align="right" >
<a href="">HOME</a> | 
<a href="">CONTACT</a> | 
<a href="">ABOUT</a> |
<a href="">LINKS</a>
</div>

<div id="content" align="left" >
<h5>Content Articles</h5>
<p>This paragraph would be your content
 paragraph with all of your readable material.</p>
<h5 >Content Article Number Two</h5>
<p>Here's another content article right here.</p>
</div>

暂无
暂无

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

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