Elements

Elements constitute the bulk of the contents of an XML document. An element should be thought of as content surrounded by start and end tags. The content can either be textual data or more elements, but never both. It is also possible that an element is empty, in the sense that it does not contain any data at all. For example, consider the hubcaps element:

<hubcaps>
    hub cap1
</hubcaps>

In this element, the hubcaps element consists of the <hubcaps> start tag, the hub cap1 string as its content, and the </hubcaps> end tag. Alternatively, consider the engines element:

<engines>
    <engine id="E129" type="Alpha37" capacity="2500" price="3500">
        Engine 1
    </engine>
</engines>

The engines element does not contain any character data as its content, ...

Get Java™ APIs for XML Kick Start 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.