Quackit Logo
HTML
CSS
Scripting
Database
Hosting
Design
XML

Print Version

DTD Attributes

Just as you need to define all elements in your DTD, you also need to define any attributes they use. You use the <!ATTLIST> declaration to define attributes in your DTD.

Syntax

You use a single <!ATTLIST> declaration to declare all attributes for a given element. In other words, for each element (that contains attributes), you only need one <!ATTLIST> declaration.

The <!ATTLIST> declaration has the following syntax:

<!ATTLIST element_name
  attribute_name TYPE DEFAULT_VALUE
  attribute_name TYPE DEFAULT_VALUE
  attribute_name TYPE DEFAULT_VALUE
  ...>

Here, element_name refers to the element that you're defining attributes for, attribute_name is the name of the attribute that you're declaring, TYPE is the attribute type, and DEFAULT_VALUE is it's default value.

Example

<!ATTLIST tutorial
  published CDATA "No">

Here, we are defining an attribute called "published" for the "tutorial" element. The attribute's type is CDATA and it's default value is "No".

Enjoy this website?

  • Share
  • Add this page to your Favorites
  • Link to this page (copy/paste into your own website or blog):
  • Link to Quackit using one of these banner ads.
  • Help support Quackit by making a donation

Oh, and thank you for supporting Quackit!

© Copyright 2000 - 2010 Quackit.com