XmlLoadSettings.MaxElementDepth Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets and sets the limits of the element depth of an XML document to be loaded into a DOM object.
public:
property unsigned int MaxElementDepth { unsigned int get(); void set(unsigned int value); };
uint32_t MaxElementDepth();
void MaxElementDepth(uint32_t value);
public uint MaxElementDepth { get; set; }
var uInt32 = xmlLoadSettings.maxElementDepth;
xmlLoadSettings.maxElementDepth = uInt32;
Public Property MaxElementDepth As UInteger
Property Value
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.