Vb.net HtmlAgilityPack从html中清除内部文本
我有这个html。我试图在没有任何标记的情况下获取其内部文本Vb.net HtmlAgilityPack从html中清除内部文本,vb.net,dom,html-parsing,html-agility-pack,strip-tags,Vb.net,Dom,Html Parsing,Html Agility Pack,Strip Tags,我有这个html。我试图在没有任何标记的情况下获取其内部文本 <h1>my h1 content</h1> <div class="thisclass"> <p> some text</p> <p> some text</p> <div style="some_style"> some text <script type="text/javascript">
<h1>my h1 content</h1>
<div class="thisclass">
<p> some text</p>
<p> some text</p>
<div style="some_style">
some text
<script type="text/javascript">
<!-- some script -->
</script>
<script type='text/javascript' src='some_script.js'></script>
</div>
<p> some text<em>some text</em>some text.<em> <br /><br /></em><strong><em>some text</em></strong></p>
<p> </p>
</div>
有人有什么想法吗
谢谢。试试这个(警告c#提前编码):
这给了我以下输出:
my h1 content some text some textsome text some textsome textsome text. some text
希望这有帮助
foreach(var script in root.SelectNodes("//script"))
{
script.ParentNode.RemoveChild(script);
}
Console.WriteLine(root.InnerText);
my h1 content some text some textsome text some textsome textsome text. some text