HTML.and.XHTML.The.Complete.Reference.4th.Edition [Electronic resources]

Thomas Powell

نسخه متنی -صفحه : 252/ 218
نمايش فراداده

SGML and XML Keywords

The previous SGML example declares the lang attribute as having values of type NAME, an alphabetic string. NAME is one of several SGML/XML keywords occurring in HTML and XHTML's declarations of an attribute's type:

  • CDATA Unparsed character data

  • ID A document-wide unique identifier

  • IDREF A reference to a document-wide identifier

  • NAME An alphabetic character string plus a hyphen and a period

  • NMTOKEN An alphanumeric character string plus a hyphen and a period

  • NUMBER A character string containing decimal numbers

Notice in early DTD fragment for <bdo> that the dir attribute does not declare its type using a keyword. Instead, the type is specified using an enumerated list containing two possible values, ltr and rtl. In that example for either SGML or XML, the attribute's default behavior is specified with a keyword. A default value may be specified using a quoted string.

  • #REQUIRED A value must be supplied for the attribute.

  • #IMPLIED The attribute is optional.

  • #FIXED The attribute has a fixed value that is declared in quotes using an additional parameter. Because the attribute/value pair is assumed to be constant, it does not need to be used in the document instance.