XmlLoadSettings XmlLoadSettings XmlLoadSettings XmlLoadSettings Class

Contains settings that are used during loading and parsing of XML documents. The default settings are chosen for the highest security. This class can be instantiated and is accepted by LoadXml(String), LoadFromUriAsync(Uri, XmlLoadSettings), and LoadFromFileAsync(IStorageFile, XmlLoadSettings).

Syntax

Declaration

public sealed class XmlLoadSettingspublic sealed class XmlLoadSettingsPublic NotInheritable Class XmlLoadSettingspublic sealed class XmlLoadSettings

Constructors summary

Creates a new XmlLoadSettings object.

Properties summary

Specifies whether default handling preserves white space.

Gets and sets the limits of the element depth of an XML document to be loaded into a DOM object.

Gets or sets a value that specifies whether to prohibit or allow the inclusion of a DTD in the XML DOM document.

Gets or sets a value that specifies whether external definitions, resolvable namespaces, external subsets of document type definitions (DTDs), and external entity references are to be resolved at the time the document is parsed.

Gets or sets a value that specifies whether the XML parser should validate this document against the document type definition (DTD) on loading.

Constructors

  • XmlLoadSettings()
    XmlLoadSettings()
    XmlLoadSettings()
    XmlLoadSettings()

    Creates a new XmlLoadSettings object.

    public XmlLoadSettings()public New()Public Sub New()public XmlLoadSettings()

Properties

  • ElementContentWhiteSpace
    ElementContentWhiteSpace
    ElementContentWhiteSpace
    ElementContentWhiteSpace

    Specifies whether default handling preserves white space.

    public bool ElementContentWhiteSpace { get; set; }public bool ElementContentWhiteSpace { get; set; }Public ReadWrite Property ElementContentWhiteSpace As boolpublic bool ElementContentWhiteSpace { get; set; }

    Property Value

    • bool
      bool
      bool
      bool

      True if default processing preserves white space; otherwise false. The default value is true.

  • MaxElementDepth
    MaxElementDepth
    MaxElementDepth
    MaxElementDepth

    Gets and sets the limits of the element depth of an XML document to be loaded into a DOM object.

    public uint MaxElementDepth { get; set; }public uint MaxElementDepth { get; set; }Public ReadWrite Property MaxElementDepth As uintpublic uint MaxElementDepth { get; set; }

    Property Value

    • uint
      uint
      uint
      uint

      The depth value. The default value is 256.

    Remarks

    A zero (0) value means no limits on the element depth of an XML document. A non-zero value specifies the maximum depth.

    An entity counts as one level of nesting. For example, if you have an entity that references an XML document that includes two nested XML elements, set the value to 3.

    When the DOM object is cloned, the value of this property is propagated to the cloned object. When the size of an XML document exceeds the limit set by this property, a load error will result when the document is parsed.

    This property helps to avoid denial of service attacks in which a document is submitted that has excessive element depth. Failure to limit the element depth leaves you open to the exploit where a relatively small XML document can cause denial of service. The MaxElementDepth property mitigates this threat. If you are concerned about denial of service, you should set this property to a value that allows you to load your documents yet limits depth to a reasonable level.

  • ProhibitDtd
    ProhibitDtd
    ProhibitDtd
    ProhibitDtd

    Gets or sets a value that specifies whether to prohibit or allow the inclusion of a DTD in the XML DOM document.

    public bool ProhibitDtd { get; set; }public bool ProhibitDtd { get; set; }Public ReadWrite Property ProhibitDtd As boolpublic bool ProhibitDtd { get; set; }

    Property Value

    • bool
      bool
      bool
      bool

      True to prohibit the inclusion of a DTD in the XML DOM document; false to allow the inclusion. The default value is true.

    Remarks

    This property allows you to prohibit DTD use and can help prevent a denial of service attack in some situations. For example, an application might become unresponsive if a large number of entity references are included with the DTD and require resolution when the document XML is parsed and loaded.

  • ResolveExternals
    ResolveExternals
    ResolveExternals
    ResolveExternals

    Gets or sets a value that specifies whether external definitions, resolvable namespaces, external subsets of document type definitions (DTDs), and external entity references are to be resolved at the time the document is parsed.

    public bool ResolveExternals { get; set; }public bool ResolveExternals { get; set; }Public ReadWrite Property ResolveExternals As boolpublic bool ResolveExternals { get; set; }

    Property Value

    • bool
      bool
      bool
      bool

      True if external definitions, resolvable namespaces, external subsets of DTDs, and external entity references are resolved at the time the document is parsed; otherwise false. The default value is false.

    Remarks

    When this property is true, external definitions are resolved at parse time. This allows default attributes and data types to be defined on elements from the schema and allows use of the DTD as a file inclusion mechanism.

    This setting is independent of whether validation is to be performed, as indicated by the value of the ValidateOnParse property. If externals cannot be resolved during validation, a validation error occurs. When the value of ResolveExternals is false, externals are not resolved and validation is not performed.

    A resolvable namespace is indicated by a namespace Universal Resource Identifier (URI) that begins with "x-schema:" as its prefix.

  • ValidateOnParse
    ValidateOnParse
    ValidateOnParse
    ValidateOnParse

    Gets or sets a value that specifies whether the XML parser should validate this document against the document type definition (DTD) on loading.

    public bool ValidateOnParse { get; set; }public bool ValidateOnParse { get; set; }Public ReadWrite Property ValidateOnParse As boolpublic bool ValidateOnParse { get; set; }

    Property Value

    • bool
      bool
      bool
      bool

      If true, the internal or external DTD will be used to validate the document. The default value is false.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ThreadingAttribute

Details

Assembly

Windows.Data.Xml.Dom.dll