Document Type Definitions (DTDs)

Document Type Definitions (DTDs) are one of two main types of documents you can use to specify XML document structure. Section 19.6 presents W3C XML Schema documents, which provide an improved method of specifying XML document structure.

Software Engineering Observation 19 2

XML documents can have many different structures, and for this reason an application cannot be certain whether a particular document it receives is complete, ordered properly, and not missing data. DTDs and schemas (Section 19.6) solve this problem by providing an extensible way to describe XML document structure. Applications should use DTDs or schemas to confirm whether XML documents are valid.

Software Engineering Observation 19 3

Many organizations and individuals are creating DTDs and schemas for a broad range of applications. These collectionscalled repositoriesare available free for download from the Web (e.g., www.xml.org, www.oasis-open.org).

 

Creating a Document Type Definition

Figure 19.4 presented a simple business letter marked up with XML. Recall that line 5 of letter.xml references a DTDletter.dtd (Fig. 19.9). This DTS specifies the business letter's element types and attributes, and their relationships to one another.

Figure 19.9. Document Type Definition (DTD) for a business letter.

(This item is displayed on page 945 in the print version)

1 2 3 4

Категории

© amp.flylib.com,