Document Type Definitions

XML involves two primary steps: defining your tags (or elements) and using those tags. In the previous script you referenced elements such as album and artist. Here you will learn how to give those labels meaning.

With HTML, the tags have already been defined for you, but XML allows you to create your own. You can do this either within the document type declaration section of your XML file or in a separate DTD file, as I would recommend. This process is called document modeling, because you are creating a paradigm for how your files should be written. A DTD defines every element and attribute for your markup language.

The syntax for defining an element is

<!ELEMENT name TYPE> 

where name is the name of the new tag and ...

Get PHP Advanced for the World Wide Web: Visual QuickPro Guide 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.