HtmlTokenizerMaxElementDepth Property

Get or set the maximum element depth.

Definition

Namespace: MimeKit.Text
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public int MaxElementDepth { get; set; }

Property Value

Int32
The maximum element depth.

Remarks

Gets or sets the maximum number of distinct nested elements that will be tracked.

In order to tokenize the content of elements such as <style>, <title> and <![CDATA[ the same way that a web browser would, the tokenizer keeps track of which elements are open (and, in particular, whether they are SVG or MathML elements). Consecutive nested elements that are identical share a single entry, so arbitrarily deep nesting of the same element does not count towards this limit.

Once a start tag exceeds this limit, the tokenizer can no longer reliably determine how the remainder of the document would be tokenized by a web browser. To avoid misinterpreting markup that follows, that start tag is the last tag token returned; the remainder of the input is returned as HtmlDataTokens containing literal text.

Exceptions

ArgumentOutOfRangeException value is less than 1.

See Also