XML on TPF: A Short Tutorial Page 3 of 14
Create a Sample DTD
A Document Type Definition (DTD) is one method of defining the acceptable tags for an XML document. A DTD has a
strict syntax and can be either inside the XML document itself or in a separate file. When it is in a separate file,
the XML document has specific coding to reference the location of the DTD. This sample DTD resides in its own file.
This sample DTD might be used to represent a passenger name record (PNR) in the airline industry. The organization of data
in an XML document is the key to its success. However, this DTD is less focused on
a realistic implementation and more focused on demonstrating the various ways to write XML data:
See how elements, nested elements, and attributes are used.
Click File --> Save As.
Save the file in C:\xmltut as pnrdtd. The default file name may be pnrdtd.txt or pnrdtd.html. If this is true, ensure that you remove the .txt or .html extension. (The XML document on the next page calls the DTD, so the name must match exactly. For this, there is no extension to the DTD file.)
Close the window by clicking the X in the upper-right corner.
Note: When you are using a DTD on your TPF 4.1 system, you will need to include a
declaration statement at the top of the document to indicate in which encoding the DTD is
written. For example:
<?xml version="1.0" encoding="ISO-8859-1"?>
When this line is included, some browsers will attempt to parse the DTD as an XML document.
We have omitted this line from the sample DTD to ensure that you can view the DTD in your
browser. See the TPF XML User's Guide for more information about encodings.
Once you have saved the DTD, you are ready to continue.
For More Information
See the TPF XML User's Guide for the following:
A list of books and Web sites for learning about DTDs and their syntax
More information about
specifying the encoding of your documents on the TPF 4.1 system.