Skip to content

This library uses AngelSharp to parse an HTML string into a document object model. The library targets .NET Framework 4.7.2 so that it is compatible with Windows PowerShell.

Notifications You must be signed in to change notification settings

nstevens1040/AngleSharp.DOMParser

Repository files navigation

Build status

AngleSharp.DOMParser

This library uses AngelSharp to parse an HTML string into a document object model. The library targets .NET Framework 4.7.2 so that it is compatible with Windows PowerShell.

Build the Library

Compiling in Windows PowerShell

git clone https://github.com/nstevens1040/AngleSharp.DOMParser.git
cd .\AngleSharp.DOMParser\
MSBuild.exe -p:RestorePackagesConfig=true -t:restore
MSBuild.exe .\AngleSharp.DOMParser\AngleSharp.DOMParser.csproj

Load the Library

Into Windows PowerShell and then test it.

Add-Type -Path .\AngleSharp.DOMParser\bin\build\AngleSharp.DomParser.dll
$html_string = @"
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8"/>
        <meta name="viewport" content="width=device-width,initial-scale=1"/>
        <title>Testing HTML</title>
    </head>
    <body>
        <h1>Heading</h1>
        <article>
            <section>
                <h2>subtitle</h2>
                <p>paragraph</p>
                <span id="test">Test succeeded!</span>
            </section>
        </article>
    </body>
</html>
"@
$document = [AngleSharp.DomParser]::GetDomDocument($html_string)
$document.GetElementById("test").TextContent

If the test succeeds, then your PowerShell output will be

Test succeeded!

About

This library uses AngelSharp to parse an HTML string into a document object model. The library targets .NET Framework 4.7.2 so that it is compatible with Windows PowerShell.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published