IBM®
Skip to main content
    United States [change]      Terms of use
 
 
   
     Home      Products      Services & solutions      Support & downloads      My account     
     
  XML on TPF: A Short Tutorial IBM

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.

To view the full document, open Paul's XML document in another browser window. See how the structure of the data matches that of the DTD you studied on the previous page. When you are done, close the window by clicking the X in the upper-right corner.

For More Information
See the TPF XML User's Guide for the following:

  • A list of books and Web sites for learning about writing XML documents
  • More information about well-formed and valid XML documents.

PreviousNext

Back to the Beginning
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10

 

Close This Window.

 

    About IBM Privacy Contact