Grabbing meta-tags and comments using HTML Agility Pack

前端 未结 1 1428
眼角桃花
眼角桃花 2020-12-17 06:05

I\'ve looked for tutorials on using HTML Agility Pack as it seems to do everything I want it to do but it seems that for such a powerful tool there is little noise about it

相关标签:
1条回答
  • 2020-12-17 06:35

    HtmlAgilityPack's HtmlDocument implements IXpathNavigable, thus it uses the standard .NET XPath engine. Any XPath 1.0 documentation will be applicable, especially if it talks about System.Xml.XPath.

    "//comment()" finds all comments
    "//meta" finds all "meta" elements

    HtmlDocument was designed to look very much like XmlDocument, so examples and tutorials about it will be somewhat applicable.

    Some MSDN links:

    • XPath Reference
    • Examples
    • XPath functions
    0 讨论(0)
提交回复
热议问题