XML on TPF: A Short Tutorial Page 4 of 10
Create the Sample XML Data Based on the DTD
An XML document is a file that contains data surrounded by XML markup. It must have an XML declaration statement
at the top of the document and may be based on a DTD or XML Schema.
Paul wants his application to demonstrate both validating and nonvalidating parsing. His first XML document is based on
his DTD. Paul begins with
the XML declaration statement, which includes the encoding he is using for this document:
<?xml version="1.0" encoding="ISO-8859-1"?>
He then adds the statement to declare the root element of the XML document (PNRroot) and the DTD on which the XML document is written (pnrdtd):
<!DOCTYPE PNRroot SYSTEM "pnrdtd">
Finally, he can create some sample data by using the element and attribute names defined in the DTD.
When he has written the sample XML data, Paul saves it to his workstation as pnrd.xml.