Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nstevens1040/anglesharpparser
This .NET 6.0 library uses AngleSharp to parse an HTML string into a DOM. It is written such that it can be easily used in PowerShell Core.
https://github.com/nstevens1040/anglesharpparser
csharp document-object-model dom dotnet-6 dotnet-core html net-core net-core-6 net6 parse parser powershell powershell-core
Last synced: 27 days ago
JSON representation
This .NET 6.0 library uses AngleSharp to parse an HTML string into a DOM. It is written such that it can be easily used in PowerShell Core.
- Host: GitHub
- URL: https://github.com/nstevens1040/anglesharpparser
- Owner: nstevens1040
- Created: 2023-04-29T00:55:31.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-04-30T14:52:42.000Z (almost 2 years ago)
- Last Synced: 2024-11-15T11:08:05.359Z (3 months ago)
- Topics: csharp, document-object-model, dom, dotnet-6, dotnet-core, html, net-core, net-core-6, net6, parse, parser, powershell, powershell-core
- Language: C#
- Homepage:
- Size: 519 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Build status](https://ci.appveyor.com/api/projects/status/115e41aqm9s820b5?svg=true)](https://ci.appveyor.com/project/nstevens1040/anglesharpparser)
# AngleSharpParser
## PowerShell Core Quick Start
### Load the DLL into PowerShell Core
```ps1
try { Set-ExecutionPolicy Bypass -Scope Process -Force } catch {}
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
[System.Net.WebClient]::New().DownloadFile(
"https://github.com/nstevens1040/AngleSharpParser/releases/latest/download/AngleSharpParser-latest.nupkg",
"$($ENV:USERPROFILE)\Desktop\AngleSharpParser-latest.nupkg"
)
$null = mkdir "$($ENV:USERPROFILE)\Desktop\AngleSharpParser-latest"
Expand-Archive -Path "$($ENV:USERPROFILE)\Desktop\AngleSharpParser-latest.nupkg" -DestinationPath "$($ENV:USERPROFILE)\Desktop\AngleSharpParser-latest"
Add-Type -Path "$($ENV:USERPROFILE)\Desktop\AngleSharpParser-latest\lib\net6.0\AngleSharpParser.dll"
```
### Do a simple test
```ps1
$html_string = @"
Testing HTML
Heading
subtitle
paragraph
Test succeeded!
"@
$parser = [Angle.Sharp]::New()
$document = $parser.GetDomDocument($html_string)
$document.GetElementById("test").TextContent
```
The output should read
```ps1
Test succeeded!
```