Creating Document Type Declarations

You define the syntax and structure of elements using a document type definition (DTD), and you declare that definition in a document using a document type declaration. We've seen that you use <!DOCTYPE> to create a document type declaration. This element can take many different forms, as you see here (here, URL is the URL of a DTD, and rootname is the name of the root element); we'll see all these forms in this chapter:

  • <!DOCTYPE rootname [DTD]>

  • <!DOCTYPE rootname SYSTEM URL >

  • <!DOCTYPE rootname SYSTEM URL [DTD]>

  • <!DOCTYPE rootname PUBLIC identifier URL>

  • <!DOCTYPE rootname PUBLIC identifier URL [DTD]>

To use a DTD, you need a document type declaration, which means that you need <!DOCTYPE>. The <!DOCTYPE> declaration ...

Get Inside XML 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.