Export (0) Print
Expand All

XmlKnownDtds Enumeration

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)

[FlagsAttribute]
public enum XmlKnownDtds

Member nameDescription
NoneSpecifies that the XmlPreloadedResolver will not recognize any of the predefined DTDs.
Xhtml10Specifies that the XmlPreloadedResolver will recognize DTDs and entities that are defined in XHTML 1.0.
Rss091Specifies that the XmlPreloadedResolver will recognize DTDs and entities that are defined in RSS 0.91.
AllSpecifies that the XmlPreloadedResolver will recognize all currently supported DTDs. This is the default behavior.

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.



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();
}


Silverlight

Supported in: 5, 4, 3

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

Community Additions

ADD
Show:
© 2014 Microsoft