CSharp · Console
using System;
using AngleSharp;
using AngleSharp.Html.Parser;
class MyClass {
static void Main() {
//Use the default configuration for AngleSharp
var config = Configuration.Default;
//Create a new context for evaluating webpages with the given config
var context = BrowsingContext.New(config);
//Source to be parsed
var source = @"<h3> This is a simple title </h3>
</br>
<p>Lorem ipsum <b> dolor sit </b> amet consectetur, <i>adipisicing elit.</i> </p>
";
//Create a virtual request to specify the document to load (here from our fixed string)
var parser = context.GetService<IHtmlParser>();
var document = parser.ParseDocument(source);
//Do something with document like the following
Console.WriteLine(document.DocumentElement.TextContent);
}
}