Your First XML Program

The first example consists of two files, one in XML and the other in HTML. Listing 1.2 shows the XML file; you'll see the HTML file in Hour 2, "Using HTML Files to Display the Data of XML Files." This example, and many other examples throughout this book, will use the basic structure of an email message as a model.

Listing 1.2 A Simple XML Data File
1:<?xml version="1.0"?>
2: <!-- This is our first XML file -->
3: <MESSAGE>
4: <TO>STUDENT</TO>
5: <FROM>AUTHOR</FROM>
6: <SUBJECT>Introduction to XML</SUBJECT>
7: <BODY>Welcome to XML!</BODY>
8:  </MESSAGE>

Internet Explorer 5.0 can be used to verify the well-formed properties of XML files. To do so, simply click File, Open in IE to select the XML file. If the file is well-formed, ...

Get Sams Teach Yourself XML in 24 Hours 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.