Brackets 0.6.3
dotnet add package Brackets --version 0.6.3
NuGet\Install-Package Brackets -Version 0.6.3
<PackageReference Include="Brackets" Version="0.6.3" />
paket add Brackets --version 0.6.3
#r "nuget: Brackets, 0.6.3"
// Install Brackets as a Cake Addin #addin nuget:?package=Brackets&version=0.6.3 // Install Brackets as a Cake Tool #tool nuget:?package=Brackets&version=0.6.3
Brackets
Resilient markup parser library
The library is used to parse XML and HTML files. The parser produces a tree of nodes that represent the structure of the document. The parse tree is very simple by design and doesn't try to replicate the document object model (DOM) in any way.
Ill-structured documents will be parsed without errors. The parser will try to detect and correct stray tags, broken tags, etc.
Usage
Both HTML and XML parsers are derived from the MarkupParser<TMarkupLexer>
class and are used in the same way. You can access the parsers using the Document.Html
and the Document.Xml
static properties or by instantiating the HtmlParser
and the XmlParser
classes. The parsers provided by the static properties of the Document
class are thread-safe and can be used in multiple threads simultaneously. The parsers instantiated directly are not thread-safe but can be slightly faster.
To parse a document from a string, use the Parse
method of the MarkupParser
class.
// Parse a string
var document = Document.Html.Parse("<html><head></head><body></body></html>");
// Search for a body element using XPath
var body = document.Find("/html/body").FirstOrDefault() as ParentTag;
To parse a document from a file or any stream, use the ParseAsync
method of the MarkupParser
class.
// Parse a stream
var document = await Document.Html.ParseAsync(stream, cancellationToken);
// Search for a body element using XPath
var body = document.Find("/html/body").FirstOrDefault() as ParentTag;
ParseAsync
can also accept an encoding
parameter that specifies the encoding of the document. The default encoding is UTF-8. In any case the parser will automatically detect the encoding of the document from the markup and update it on the fly.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- System.IO.Pipelines (>= 8.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Brackets:
Package | Downloads |
---|---|
ReadabilityLib
A C# port of standalone version of the readability lib |
|
SyndicationLib
RSS and ATOM feed reader/parser |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.6.3 | 77 | 10/10/2024 |
0.6.2 | 75 | 9/27/2024 |
0.6.1 | 86 | 6/5/2024 |
0.6.0 | 81 | 5/19/2024 |
0.6.0-beta | 81 | 4/3/2024 |
0.5.9 | 105 | 2/24/2024 |
0.5.5-beta | 231 | 10/21/2023 |
0.5.4-beta | 85 | 10/19/2023 |
0.5.0-beta | 93 | 10/12/2023 |