Elements in an XML Document

Elements are used to define the structure of an XML document. Elements are the basic unit of markup in XML and are defined by tags. They must form a hierarchy. Elements in turn may contain other elements, character data, processing instructions, or CDATA (character data) sections.

Elements are identified using tags, which contain a tag name within the current namespace. The syntax of tag representation is similar to that of XML, as shown in the document fragment below.

  <book>
    <title>Hello World and Other Stories</title>
    <publisher>Small World Press</publisher>
  </book>
...

XML documents are represented as a hierarchy. This hierarchy is composed of elements and their tags, with a single required root element that represents ...

Get J2EE™ and Beyond: Design, Develop, and Deploy World-Class Java™ Software 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.