Luk*_*uke 3 html c# xml parsing
我有一个像这样的html表达式:
"This is <h4>Some</h4> Text" + Environment.NewLine +
"This is some more <h5>text</h5>
Run Code Online (Sandbox Code Playgroud)
我只想提取文本.所以结果应该是
"This is Some Text" + Environment.NewLine +
"This is some more text"
Run Code Online (Sandbox Code Playgroud)
我该怎么做呢?
string html = @"This is <h4>Some</h4> Text" + Environment.NewLine +
"This is some more <h5>text</h5>";
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(html);
var str = doc.DocumentNode.InnerText;
Run Code Online (Sandbox Code Playgroud)