Microsoft.Xml.SgmlReader 1.8.25

.NET 5.0 .NET Core 3.1 .NET Standard 2.0 .NET Framework 4.5
Install-Package Microsoft.Xml.SgmlReader -Version 1.8.25
dotnet add package Microsoft.Xml.SgmlReader --version 1.8.25
<PackageReference Include="Microsoft.Xml.SgmlReader" Version="1.8.25" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Microsoft.Xml.SgmlReader --version 1.8.25
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Microsoft.Xml.SgmlReader, 1.8.25"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Microsoft.Xml.SgmlReader as a Cake Addin
#addin nuget:?package=Microsoft.Xml.SgmlReader&version=1.8.25

// Install Microsoft.Xml.SgmlReader as a Cake Tool
#tool nuget:?package=Microsoft.Xml.SgmlReader&version=1.8.25
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

SgmlReader - Convert (almost) any HTML to valid XML

SgmlReader is a versatile C# .NET library written by Chris Lovett for parsing SGML files using the XmlReader API including HTML and OFX data. A command line utility is also provided which outputs the well formed XML result.

MindTouch uses the SgmlReader library extensively. They have also made many improvements to it.

SgmlReaderDll API

The SgmlReader is an implementation of the XmlReader API. So the only thing you really need to know is how to construct it. SgmlReader has a default constructor, then you need to set some of the properties. To load a DTD you must specify DocType="HTML" or you must provide a SystemLiteral. To specify the SGML document you must provide either the InputStream or Href. Everything else is optional. Then you can read from this reader like any other XmlReader class.

Nuget Package

This code is packaged and published at https://www.nuget.org/packages/Microsoft.Xml.SgmlReader/ for your convenience. Using Visual Studio, Manage Nuget Packages simply search for the online package named "Microsoft.Xml.SgmlReader" add it to your project and you are good to go.

Sample Usage

// setup SgmlReader
Sgml.SgmlReader sgmlReader = new Sgml.SgmlReader()
{
    DocType = "HTML",
    WhitespaceHandling = WhitespaceHandling.All,
    CaseFolding = Sgml.CaseFolding.ToLower,
    InputStream = reader
};

// create document
XmlDocument doc = new XmlDocument()
{
    PreserveWhitespace = true,
    XmlResolver = null
};
doc.Load(sgmlReader);
return doc;

Release History

Release notes for 1.8.25

  • Performance improvement parsing attributes with empty values.
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net45 net451 net452 net46 net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Universal Windows Platform uap uap10.0
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.1

    • No dependencies.
  • .NETFramework 4.5

    • No dependencies.
  • .NETFramework 4.6

    • No dependencies.
  • .NETFramework 4.7

    • No dependencies.
  • .NETFramework 4.8

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net5.0

    • No dependencies.
  • UAP 0.0

    • No dependencies.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Microsoft.Xml.SgmlReader:

Package Downloads
jcoliz.OfxSharp.NetStandard

OFX file parser in a .NET Standard library

Restless.OfxSharper

Provides Ofx parsing and building services

SgmlSanitizer

A sanitizer to remove elements and attributes from SGML based text files, such as HTML and XML. Note that this is a very simple implementation, but by using whitelists and a naïve URL detection implementation XSS may be prevented. Use at your own risk though.

Devlooped.Web The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Read HTML as XML and query it with CSS over XLinq

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on Microsoft.Xml.SgmlReader:

Repository Stars
xamarin/xamarin-android
Xamarin.Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
microsoft/XmlNotepad
XML Notepad provides a simple intuitive User Interface for browsing and editing XML documents.
Version Downloads Last updated
1.8.25 20,049 9/29/2021
1.8.24 3,298 7/23/2021
1.8.23 363 7/21/2021
1.8.22 188 7/20/2021
1.8.21 9,787 3/18/2021
1.8.20 383 2/2/2021
1.8.19 788 1/29/2021
1.8.18 5,711 10/25/2020
1.8.17 4,017 7/24/2020
1.8.16 24,590 6/1/2020
1.8.15 376 6/1/2020
1.8.14 158,270 2/3/2017
1.8.13 1,361 9/11/2016
1.8.12 846 9/11/2016