XML DTD

General Principles

Define the purpose of DTDs in relation to XML documents as a limited and simple way to define the structure of a document.

Be comfortable with DTD terminology: element, attribute, entity, etc.

Realise that like XML, which is based on SGML, XML DTDs are based on SGML DTDs.

Know how to put comments in an XML DTD.

Not covered:

  • SGML DTDs, when they differ from XML DTDs (no other knowledge of SGML is required)
DOCTYPE definition Define a DTD for an XML document:
  • using an internal DOCTYPE declaration
    • using only the subset of DTD constructs allowed in an internal declaration
  • using an external DOCTYPE declaration
    • with the SYSTEM identifier
    • with the PUBLIC identifier
  • using a text declaration (<?xml encoding="..." ?>)
  • using a mixed DOCTYPE declaration (part internal, part external)
    • with references from one to the other as allowed by the specification
    • applying the precedence rules
Elements

Describe the syntax for defining the root element of a document.

Use <!ELEMENT ...> to describe:

  • an empty element
  • an element containing text but no nested elements
  • an element containing nested elements but no text
    • syntax for specifying the order and number of element occurrences
  • a mixed element (containing both text and nested elements)
Attributes

Define which attributes are available for an element using <!ATTLIST ...>.

Describe the following attribute types:

  • an attribute with a value from a list of possible values
  • a character data attribute (CDATA)
  • ID attributes
  • IDREF / IDREFS attributes
  • NMTOKEN / NMTOKENS attributes
  • ENTITY / ENTITIES attributes

Indicate the default value:

  • a mandatory attribute (REQUIRED)
  • an optional attribute (IMPLIED)
  • an attribute with a fixed value (FIXED)
  • a default value

Not covered:

  • the NOTATION attribute type
Parsed Entities

Use the built-in entities to allow the characters <, >, / and & in an XML document.

Defining entities:

  • internal entities
  • external entities
    • with the SYSTEM identifier
    • with the PUBLIC identifier

Defining parameter entities:

  • group attributes into a parameter entity
  • include one parameter entity within another
  • reference a parameter entity from a DTD

Not covered:

  • unparsed entities

你可能感兴趣的:(xml)