【问题标题】:HtmlAgilityPack get contents in a comments lineHtmlAgilityPack 获取注释行中的内容
【发布时间】:2013-11-29 16:33:45
【问题描述】:

我想在注释行字符串中获取内容值:

<!-- <meta itemprop="contentURL" content="http://**.com/za6dc7.mp4" />-->

 Dim node As HtmlAgilityPack.HtmlNode = doc.DocumentNode.SelectSingleNode("//meta[@item='contentURL']")
 TextBox1.Text += node.GetAttributeValue("content", String.Empty)

感谢您的帮助。

【问题讨论】:

    标签: html dom get comments


    【解决方案1】:

    不确定是否可行。我宁愿处理这里提到的所有评论节点How to select node types which are HtmlNodeType.Comment using HTMLAgilityPack,然后为每个评论的内容创建新的 HTMLDocument,然后从中提取必要的信息。

    UPD:HAP 速度很快,因此不会降低性能。

    【讨论】:

      猜你喜欢
      • 2017-10-20
      • 1970-01-01
      • 1970-01-01
      • 2017-04-19
      • 2017-09-21
      • 1970-01-01
      • 2021-09-09
      • 2017-02-24
      • 1970-01-01
      相关资源
      最近更新 更多