Document Element

Each XML document must have one—and only one—document element, which is sometimes referred to as the root element.

Caution

Be careful if you use or read the term root without any further clarification. The XML 1.0 specification uses the term apparently as a synonym for the document entity (Chapter 2 of the XML 1.0 Recommendation) and also as a synonym for the document element (Chapter 2.1).

Elements Nested Inside the Document Element

Typically, nested within the document element is a hierarchy of other elements, represented as start tag/end tag pairs or as empty element tags.

Elements must be nested correctly. The following ...

Get Sams Teach Yourself XML in 10 Minutes 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.