Anglesharp Introduction
Anglesharp is a DLL component specially developed for parsing HTML source code based on. NET (C #).
The entire DOM has been transferred to the logical class structure. Part of this structure can be resolved as shown. Notice that the picture shows the older DOM model. The current version of Anglesharp implements the latest DOM model, which is slightly different. Nonetheless, the picture is still useful to get the right idea.
Anglesharp is a. Net library that enables you to parse angular-based hypertext, such as Html,svg and MathML . An important aspect of ANGLESHARP is that CSS can also be parsed. The parser is built on the official web-based specifications.
Reference
Http://www.cnblogs.com/pandait/p/AngleSharp.html
Https://www.cnblogs.com/liguobao/p/6130121.html
get Anglesharp with NuGet
The simplest way to integrate Anglesharp into your project is to use NuGet. You can install Anglesharp by opening the Package Manager console (PM) and entering the following statement:
Install-package Anglesharp
You can also use the graphics Library Package Manager ("Manage NuGet packages for solutions"). searching for "Anglesharp" in the official NuGet online source will find this library.
Example
//Create a (reusable) parser front end varParser =NewHtmlparser ();//HTML DOM nodevarSource ="";//Parsing source FilesvarDocument =parser. Parse (source);//Create P tagsvarp = document. CreateElement ("P");p. Textcontent="This is another paragraph.";//Add to Domdocument. Body.appendchild (p);//return full HTMLvarHTML =document. documentelement.outerhtml; viewdata["HTML"] = html;
Effect Show
ASP. NET Core uses Anglesharp crawler images