다음을 통해 공유


MaxElementDepth Property

 

Limits the element depth of an XML document to be loaded into a DOM object. A zero (0) value means no limits on the element depth of an XML document. A non-zero value specifies the maximum depth.

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.

This property is supported in MSXML 3.0 and 6.0. The default value is 0 for 3.0. The default value is 256 for 6.0.

This property has security implications. For more information, see MSXML Security Overview and DOM Security.

JScript Syntax

domObj.setProperty(strProp, intElementDepth);  
intElementDepth= domObj.getProperty(strProp);  

Visual Basic Syntax

domObj.setProperty
(strProp, intElementDepth)  
intElementDepth= domObj.getProperty
(strProp)  

C\C++ Syntax

HRESULT setProperty(BSTR strProp, VARIANT intElementDepth);  
HRESULT getProperty(BSTR strProp, VARIANT* intElementDepth);  

Parameters

strProp
A BSTR string whose value is "MaxElementDepth".

intElementDepth
An integer of the VARIANT type. The value of 0 means no limits to the element depth of the document. 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 intElementDepth to 3.

Remarks

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. Check the parseError property on the DOM for a more detailed error message.

Versioning

This property is supported in MSXML 3.0 and 6.0. The default value is 0 for 3.0. The default value is 256 for 6.0.

Applies to

Interface: IXMLDOMDocument2

Methods: setProperty | getProperty