Exploring an XML Document

The XML specification defines a standard way to add markup to documents. XML users can create their own tags, which relate to their content. Here is an example of an address book, which shows a complete XML document with user-defined tags:

<?xml version="1.0"?>

<classlist>
  <student gender="m">
    <name>
      <firstname>John</firstname>
      <middleinitial>M</middleinitial>
     <lastname>Doe</lastname>
    </name>
    <address>
      <street>10 Main St.</street>
      <city>Sacramento</city>
      <state>CA</state>
      <zip>95814</zip>
    </address>
    <phone areacode="916">123-4567</phone>
    <email>john.doe@acme.com</email>
  </student>
</classlist>

The preceding XML document contains data about a class list, marked up with tags that describe their contents. The <classlist> ...

Get Sams Teach Yourself EJB in 21 Days 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.