Rules of XML

To help explain XML, we've created the sample XML file shown in Listing 2.1.

Listing 2.1. Sample XML Document shows.xml
<?xml version="1.0"?>
<SHOWS>
     <PERFORMANCE>
          <TITLE>Fairy Princess</TITLE>
          <AUTHOR/>
          <DESCRIPTION>
               Scratch sound with emphasis on color, texture.
          </DESCRIPTION>
          <DATE status="canceled">09/11/2001</DATE>
     </PERFORMANCE>
</SHOWS>

Use a text editor to create this file and save it to your hard disk as shows.xml. Over the next few sections we will refer back to this file to illustrate the structure of XML. Later, this file will be used for showing examples within a browser.

Tags and Elements

All XML markup consists of tags. Here is a sample tag:

<PERFORMANCE>

Tags are used to build an element. Here is a sample element: ...

Get JSP™ and XML Integrating XML and Web Services in Your JSP™ Application 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.