Creating a Well-Formed XML Document

Let's take a look at the creation of a well-formed XML document. In this example, we will create a simple document for keeping track of appointments.

First, we could create this document using only elements. Here are the elements we're going to use in the document:

  • appointments— This element will serve as the root element of the document, containing all the other elements in the document.

  • event— The event element will contain the information about each individual appointment.

  • date— A child of the event element, this is the date of the event.

  • start-time— A child of the event element, this is the starting time for the appointment.

  • end-time— A child element of the event element, this is the ending time for the appointment. ...

Get Special Edition Using XML, Second 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.