任何人都可以帮助将带有敏捷包的 Html 解析为单个字符串吗?
我正在尝试解析类似于以下格式的 Html,
<blockquote>\n
<p>Here is the first collection:<\/p>\n
<ol>\n
<li>List1<\/li>\n
<li>List2<\/li>\n
<li>List3<\/li>\n
<\/ol>\n
<p>Here is the second collection:<\/p>\n
<ol>\n
<li>List1<\/li>\n
<li>List2<\/li>\n
<\/ol>\n
<\/blockquote>
我尝试使用以下方法来获取“p”和“li”和“blockquote”。但是,方法 .Descendants 为“p”、“li”和“blockquote”创建了单独的集合,但我需要将单个元素按顺序放置并将它们存储在单个字符串中。
IEnumerable<HtmlNode> h3Tags = document.DocumentNode.Descendants("p"); foreach (var h3tag in h3Tags) {}
例如,我想要我的字符串存储,“这是第一个集合:List1 List2 List3 这是第二个集合 List1 List2”。
谢谢!