Shared Documents: Why We Need DTDs

The well-formedness rules examined in Chapter 2, “The Structure of an XML Document,” and Chapter 3, “XML Must Be Well-Formed,” either ensure that XML processors handle XML documents that satisfy XML’s syntax rules or signal an error indicating that the document isn’t suitable for further processing. For some purposes, that is sufficient.

For many purposes, particularly when documents are being shared among business partners, for example, it is useful for XML documents also to conform to a known, predictable structure. Of course, it is possible to write custom code in Java or some other programming language to make appropriate checks of a received document’s structure. However, it is potentially more convenient ...

Get Sams Teach Yourself XML in 10 Minutes now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.