SCJP home
  SCWD Home
  XML Tutorial
  Java jobs
  Java News
  About Java Prepare
  Certification Books
  SCEA Books
  SCWD Books
  Online Books
   Tutorial Topics
  Basic XML
  Name Spaces
  Xlink and Xpath
SCWD home | SCJP home | XML books

Document Type Definitions (DTD)

  1. DTDs are a set of rules that define how XML data should be structured.
  2. Cooperating applications can share a single description of data known as XML vocabulary. A group of XML documents that share common XML vocabulary is known as document type and each individual document that conforms to a document type is a document instance.
  3. Multiple documents and applications can share DTDs
  4. Validity constraints ensure that any XML data conforms to its associated DTD.
  5. Only one DTD may be associated with a given XML document or data object.
  6. DTD has 2 parts - internal subset, external subset. DTD declarations in internal subset have priority over those in external subset.
  7. An XML document can be associated with only one DTD using a single DOCTYPE declaration.
  8. Syntax of DOCTYPE declaration:
    1. <!DOCTYPE doc_element SYSTEM location [internal_subset]>
    2. <!DOCTYPE doc_element PUBLIC identifier location [internal_subset]>
  9. Only comments and PIs cam be inserted between XML declaration and DOCTYPE declaration.
  10. DTDs are associated with the entire element tree via the document element.
  11. "#" character as URI fragment identifier cannot be used in the location of a DTD.
  12. The use of PUBLIC identifier should be limited to internal systems and legacy SGML applications.
  13. Four basic keywords used in DTD declaration are:
    1. ELEMENT
    2. ATTLIST
    4. ENTITY
  14. ELEMENT:
    Syntax: <!ELEMENT ele_name content_category> <!ELEMENT ele_name (content_model)cardinality)>
  15. Content_category : ANY or EMPTY
  16. Content_Model : Text only, Element only, Mixed
  17. Child elements in mixed content can appear (or not) in any order, any number of times.
  18. Syntax of mixed content:
    1. No fixed sequence
    2. #PCDATA must be the first item
    3. "*" operator is needed as the mixed content doesn't constain the no. of occurrences of the child elements.
  19. ATTLIST declaration Syntax:
  20. Attribute defaults: #REQUIRED, #IMPLIED, #FIXED, Default values
  21. Attribute types: (10 in number)
    1. CDATA
    2. Enumeration
    3. ID
    4. IDERF
    5. IDERFS
    6. NMTOKEN
    9. ENTITY
    10. ENTITIES
  22. Order of attributes cannot be enforced
  23. ID attribute type must not be used with #FIXED
  24. ID value must be unique within a given document
  25. Only one ID attribute for each element type
  26. NMTOKEN attribute prevents the inclusion of whitespace and some punctuation characters
  27. NOTATION can be used to identify
    1. The format of unparsed entities
    2. The format of element attributes of ENTITY and ENTITIES type
    3. The application associated with a PI
  28. Entities can be used to include a document inside a DTD
  29. If an element is declared more than once, its an error
  30. If an entity is declared more than once, only the first declaration is binding, other declarations are ignored.

46% off Bestsellers at BAMM.COM
SCWD home | SCJP home | XML books