Element hierarchies

A key feature of container elements is that they are often permitted to contain other elements. For example, a Book element should be expected to be able to contain Chapter elements, and Chapter elements should be able to contain Section elements. This is termed an element hierarchy.

The document element hierarchy may be visualized as boxes within boxes, or as branches of a tree. A tree representation can be drawn in any direction, but left-to-right or top-to-bottom is perhaps the most natural way to view it:

Ultimately, a complete document must be enclosed by a single element. This element lies at the root of the tree, and ...

Get XML Companion, The, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.