Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#仅提取html_C#_.net_Html Parsing - Fatal编程技术网

C#仅提取html

C#仅提取html,c#,.net,html-parsing,C#,.net,Html Parsing,基本上,我有一个嵌入css和JavaScript的网页,所以我只想提取HTML本身,从文本到表格、图像等等 到目前为止,我已经将整个网页存储到一个名为“html”的字符串中。例如,这个页面的内容就是facebook hompepage,但正如您将看到的,所有脚本和其他嵌入的东西都是我不想要的 HTMLEdit = //webpage I chose to store in here// string html = HTMLEdit.DocumentText; String re

基本上,我有一个嵌入css和JavaScript的网页,所以我只想提取HTML本身,从文本到表格、图像等等

到目前为止,我已经将整个网页存储到一个名为“html”的字符串中。例如,这个页面的内容就是facebook hompepage,但正如您将看到的,所有脚本和其他嵌入的东西都是我不想要的

   HTMLEdit = //webpage I chose to store in here//
   string html = HTMLEdit.DocumentText;
   String result = "this i want to only contain the <head>,<body>,<foot>."
HTMLEdit=//我选择存储在这里的网页//
字符串html=HTMLEdit.DocumentText;
String result=“我只想包含,,。”
我只对显示只包含html的结果感兴趣,我不想要JavaScript或css或任何其他东西

我已经看过agility pack,但网站上没有相关文档,这是我第一次决定做c#项目,如果我不懂,请原谅我的无知。

看到这个问题了吗


可能会修改这个答案,并删除链接和脚本标记。

我已经使用regex删除了标记,或者我可以将标记推到另一个字符串中吗?我正试图避免使用图书馆来做这件事。我检查了链接,解决方案和资源在那个页面上不再可用了,所以这是不可能的