Case Study Writing a DTD for the Day Planner Application

In this section, we build upon the case study introduced in Chapter 5. Figure 6.15 lists the external subset of the DTD for the day planner XML document, planner.xml. The following document type declaration is inserted into the day planner XML document

<!DOCTYPE planner SYSTEM "planner.dtd">

7 <!ATTLIST year value CDATA #REQUIRED>

10 <!ATTLIST date month CDATA #REQUIRED>

11 <!ATTLIST date day CDATA #REQUIRED>

14 <!ATTLIST note time CDATA #IMPLIED>

<3 XML DOM Test Page - Microsoft Internet Eüplorer

jnjxj

Fils Edit View Favoritas Tools Help M JM

J -«-Back - ^ g Search _*jFavorites -^History J |

I'lS Linte »

Your XML is well formed and is validated

o PI: xml o COMMENT: Fig. 5.9 : planner.xml o COMMENT: Day Planner XML document o SCHEMA: planner • ELEMENT: planner . ELEMENT: year

• ATTRIBUTE: value 2000 . ELEMENT: date

. ATTRIBUTE: month 7 . ATTRIBUTE: day 15 . ELEMENT: note

. ATTRIBUTE: time 1430 o TEXT: Doctor's appointment

. ELEMENT: note

• ELEMENT: date

© 2000 Microsoft Corporation. All rights reserved. Terms of use.

© IQ My Computer

Fig. 6.15 DTD for planner.xml.

Chapter 6

Software Engineering Observation 6.6

When an attribute's value is normalized, consecutive carriage returns/line feeds are collapsed into a single carriage return/line feed that is replaced by a space character.

Element planner is the root element of the document, which contains any number of optional year elements. The declarations (lines 6 and 7) specify that year element must contain one or more date elements and must contain an attribute value that has character data.

Line 9 indicates that a date element contains one or more note elements. Element date is required to have two attributes: month and day. Element note contains parsed character data and an optional attribute time.

+2 -1

Responses

  • michelle
    What is writing a DTD for the day planner application?
    2 years ago

Post a comment