MaxElementDepth | maxElementDepth property

XmlLoadSettings.MaxElementDepth | maxElementDepth property

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

Property value

Type: Number [JavaScript] | System.UInt32 [.NET] | uint32 [C++]

The depth value. The default value is 256.


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.

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0


Windows::Data::Xml::Dom [C++]



Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]


Windows::Data::Xml::Dom [C++]



See also




© 2016 Microsoft