Document Type Definition (DTD)

A DTD defines the way that an XML document should be created. It is essentially a constraint mechanism for an XML document. It defines the elements, the order in which they can occur, the attributes elements can have, the possible values the elements can have, and so on. The reason we need to have a DTD is to ensure that the applications that share the XML documents have a common understanding of what the tags mean. This also helps the XML parsing application process and search within the XML file. Essentially, the DTD provides the XML its portability. It ensures that any application that has the XML document, and its corresponding DTD, can process the document in a correct and consistent manner. And as you saw ...

Get Java™ APIs for XML Kick Start 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.