Xml​Load​Settings Xml​Load​Settings Xml​Load​Settings Class

Definition

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, LoadFromUriAsync, and LoadFromFileAsync.

public sealed class XmlLoadSettings : IXmlLoadSettingspublic sealed class XmlLoadSettings : IXmlLoadSettingsPublic NotInheritable Class XmlLoadSettings Implements IXmlLoadSettings
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Constructors

XmlLoadSettings() XmlLoadSettings() XmlLoadSettings()

Creates a new XmlLoadSettings object.

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

Properties

ElementContentWhiteSpace ElementContentWhiteSpace ElementContentWhiteSpace

Specifies whether default handling preserves white space.

public PlatForm::Boolean ElementContentWhiteSpace { get; set; }public bool ElementContentWhiteSpace { get; set; }Public ReadWrite Property ElementContentWhiteSpace As bool
Value
bool bool bool

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

Attributes

MaxElementDepth MaxElementDepth MaxElementDepth

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

public unsigned short MaxElementDepth { get; set; }public uint MaxElementDepth { get; set; }Public ReadWrite Property MaxElementDepth As uint
Value
uint uint uint

The depth value. The default value is 256.

Attributes

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

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

public PlatForm::Boolean ProhibitDtd { get; set; }public bool ProhibitDtd { get; set; }Public ReadWrite Property ProhibitDtd As bool
Value
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.

Attributes

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

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 PlatForm::Boolean ResolveExternals { get; set; }public bool ResolveExternals { get; set; }Public ReadWrite Property ResolveExternals As bool
Value
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.

Attributes

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

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

public PlatForm::Boolean ValidateOnParse { get; set; }public bool ValidateOnParse { get; set; }Public ReadWrite Property ValidateOnParse As bool
Value
bool bool bool

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

Attributes