IBM Version 5 manual Select required and optional content, click Finish, Example 9-3 html.dtd

Models: Version 5

1 340
Download 340 pages 15.44 Kb
Page 201
Image 201

Example 9-3 html.dtd

<!ELEMENT html (body)> <!ELEMENT body (h2, hr, table)> <!ATTLIST body

bgcolor CDATA #IMPLIED>

<!ELEMENT h2 (CENTER,CENTER)> <!ELEMENT CENTER (#PCDATA)>

<!ELEMENT table (tr+)> <!ATTLIST td

width CDATA #REQUIRED valign CDATA #REQUIRED>

<!ELEMENT tr (td,td)> <!ELEMENT td EMPTY> <!ELEMENT hr EMPTY>

After designing our html.dtd we generate html.xml file. To generate html.xml file take the following steps:

1.Select html.dtd file.

2.Right-clickGenerate—>XML file

3.Enter Airline as the folder.

4.Enter html.xml as file name, click Next.

5.Set html as root element.

6.Select required and optional content, click Finish.

Example 9-4 shows the generated XML file.

Example 9-4 html.xml source

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html SYSTEM "html.dtd" > <html>

<body>

<h2>

<CENTER>CENTER</CENTER>

<CENTER>CENTER</CENTER>

</h2>

<hr/>

<table>

<tr>

<td valign="" width=""/> <td valign="" width=""/>

</tr>

</table>

</body>

Chapter 9. Developing XML Web services 185

Page 201
Image 201
IBM Version 5 manual Select required and optional content, click Finish, Example 9-3 html.dtd, Example 9-4 html.xml source