Microsoft.Xml.SgmlReader 1.8.25

.NET 5.0 .NET Core 3.1 .NET Standard 2.0 .NET Framework 4.5
There is a newer version of this package available.
See the version list below for details.
dotnet add package Microsoft.Xml.SgmlReader --version 1.8.25
NuGet\Install-Package Microsoft.Xml.SgmlReader -Version 1.8.25
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<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
#r "nuget: Microsoft.Xml.SgmlReader, 1.8.25"
#r directive can be used in F# Interactive and Polyglot Notebooks. 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

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 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
return doc;

Release History

Release notes for 1.8.25

  • Performance improvement parsing attributes with empty values.
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 is compatible.  net461 was computed.  net462 was computed.  net463 was computed.  net47 is compatible.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap is compatible.  uap10.0 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
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 (6)

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

Package Downloads

Provides Ofx parsing and building services


OFX file parser in a .NET Standard library

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

Read HTML as XML and query it with CSS over XLinq


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.


Package Description

GitHub repositories (3)

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

Repository Stars
Xamarin.Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
XML Notepad provides a simple intuitive User Interface for browsing and editing XML documents.
Java.Interop provides open-source bindings of Java's Java Native Interface (JNI) for use with .NET managed languages such as C#
Version Downloads Last updated
1.8.30 3,276 5/9/2023
1.8.29 610 4/14/2023
1.8.28 7,379 1/4/2023
1.8.27 290 1/4/2023
1.8.26 14,033 10/25/2022
1.8.25 62,788 9/29/2021
1.8.24 3,748 7/23/2021
1.8.23 496 7/21/2021
1.8.22 321 7/20/2021
1.8.21 21,291 3/18/2021
1.8.20 544 2/2/2021
1.8.19 948 1/29/2021
1.8.18 8,303 10/25/2020
1.8.17 5,739 7/24/2020
1.8.16 24,787 6/1/2020
1.8.15 531 6/1/2020
1.8.14 168,066 2/3/2017
1.8.13 1,615 9/11/2016
1.8.12 1,352 9/11/2016