O'Reilly logo

Sams Teach Yourself XML in 10 Minutes by Andrew H. Watt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Declaring Elements in DTDs

Defining the structure of an XML document must always involve the declaration of elements because all XML documents contain at least one element: the document element.

An element declaration takes this general form:

<!ELEMENT elementTypeName contentModel > 

The allowed content models are listed here:

  • Text only— Indicated by (#PCDATA). No element content is allowed.

  • Empty element— Indicated by EMPTY. Not even whitespace is allowed as content.

  • Any content— Indicated by ANY. Any well-formed content is allowed.

  • Mixed content— Indicated by MIXED. This allows text content to be mixed with element content declared in the element declaration.

  • Child elements— Indicated by one or more element names contained in parentheses, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required