cho*_*bo2 7 .net c# html-agility-pack
我在他们的网站上找不到任何教程.我想知道我可以使用Html Agility Pack并使用它来解析字符串吗?
就像我说的那样
var fragment = "<b>Some code </b>";
Run Code Online (Sandbox Code Playgroud)
我可以使用敏捷包来摆脱<b>标签吗?到目前为止我看到的所有示例都像html文档一样加载.
如果它是HTML,那么是的.
string str = "<b>Some code</b>";
// not sure if needed
string html = string.Format("<html><head></head><body>{0}</body></html>", str);
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(html);
// look xpath tutorials for how to select elements
// select 1st <b> element
HtmlNode bNode = doc.DocumentNode.SelectSingleNode("b[1]");
string boldText = bNode.InnerText;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6887 次 |
| 最近记录: |