XmlKnownDtds Enumeration

Microsoft Silverlight will reach end of support after October 2021. Learn more.

The XmlKnownDtds enumeration is used by the XmlPreloadedResolver and defines which well-known DTDs the XmlPreloadedResolver recognizes.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

Namespace:  System.Xml.Resolvers
Assembly:  System.Xml.Utils (in System.Xml.Utils.dll)

Syntax

'Declaration
<FlagsAttribute> _
Public Enumeration XmlKnownDtds
[FlagsAttribute]
public enum XmlKnownDtds

Members

Member name Description
None Specifies that the XmlPreloadedResolver will not recognize any of the predefined DTDs.
Xhtml10 Specifies that the XmlPreloadedResolver will recognize DTDs and entities that are defined in XHTML 1.0.
Rss091 Specifies that the XmlPreloadedResolver will recognize DTDs and entities that are defined in RSS 0.91.
All Specifies that the XmlPreloadedResolver will recognize all currently supported DTDs. This is the default behavior.

Examples

The following example preloads the DTDs and entities defined in XHTML 1.0 by setting XmlKnownDtd.Xhtml10 on the XmlPreloadedResolver. In this example, the XHTMLPage.html file is a part of the application's XAP package; therefore, we have to pass a fallback resolver to the constructor of the XmlPreloadedResolver.

Dim settings As XmlReaderSettings = New XmlReaderSettings()
settings.XmlResolver = New XmlPreloadedResolver(New XmlXapResolver(), XmlKnownDtds.Xhtml10)
Using reader As XmlReader = XmlReader.Create("HTMLPage.html", settings)
    Dim document As XDocument = XDocument.Load(reader)
    OutputTextBlock.Text = document.ToString()
End Using

XmlReaderSettings settings = new XmlReaderSettings();
settings.DtdProcessing = DtdProcessing.Parse;
settings.XmlResolver =
    new XmlPreloadedResolver(new XmlXapResolver(),
        XmlKnownDtds.Xhtml10);

using (XmlReader reader = XmlReader.Create("HTMLPage.html", settings))
{
XDocument document = XDocument.Load(reader);
OutputTextBlock.Text = document.ToString();
}

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.