O'Reilly Book Excerpts: Learning Java, 2nd Edition XML Basics
for Java Developers, Part 4by Patrick Niemeyer and Jonathan
Knudsen In part four in a series of XML basics for Java
developers book excerpts from Learning Java, 2nd Edition, learn
about validating documents. "Words, words, mere words, no matter
from the heart." William Shakespeare, Troilus and Cressida In
this section, we talk about DTDs and XML Schema, two ways to
enforce rules an XML document must follow. A DTD is a grammar
for an XML document, defining which tags may appear where and in
what order, with what attributes, etc. XML Schema is the next
generation of DTD. With XML Schema, you can describe the data
content of the document in terms of primitives such as numbers,
dates, and simple regular expressions. The word schema means a
blueprint or plan for structure, so we'll refer to DTDs and XML
Schema collectively as schema where either applies Now for a
reality check. Unfortunately, Java support for XML Schema isn't
entirely mature at the time