depth

abstract val depth: Int

Returns the current depth of the element. Outside the root element, the depth is 0. The depth is incremented by 1 when a start tag is reached. The depth is decremented AFTER the end tag event was observed.

<!-- outside -->     0
<root> 1
sometext 1
<foobar> 2
</foobar> 2
</root> 1
<!-- outside --> 0