================================================================================
Prolog and Document Type

:language(xml)
================================================================================

<?xml version="1.1" encoding="UTF-8" ?>
<!DOCTYPE greeting [
  <!ELEMENT greeting (#PCDATA)>
]>
<greeting>Hello, world!</greeting>

--------------------------------------------------------------------------------

(document
  (prolog
    (XMLDecl
      (VersionNum)
      (EncName))
    (doctypedecl
      (Name)
      (elementdecl
        (Name)
        (contentspec
          (Mixed)))))
  (element
    (STag
      (Name))
    (content
      (CharData))
    (ETag
      (Name))))

================================================================================
Comment

:language(xml)
================================================================================

<!-- declarations for <head> & <body> -->
<greeting/>

--------------------------------------------------------------------------------

(document
  (prolog
    (Comment))
  (element
    (EmptyElemTag
      (Name))))

================================================================================
CDATA Section

:language(xml)
================================================================================

<greeting>
<![CDATA[<greeting>Hello, world!</greeting>]]>
</greeting>

--------------------------------------------------------------------------------

(document
  (element
    (STag
      (Name))
    (content
      (CharData)
      (CDSect
        (CDStart)
        (CData))
      (CharData))
    (ETag
      (Name))))

================================================================================
Element Tags

:language(xml)
================================================================================

<termdef id="dt-dog" term="dog">
<IMG align="left"
 src="http://www.w3.org/Icons/WWW/w3c_home" />
<br></br>
<br/>
</termdef>

--------------------------------------------------------------------------------

(document
  (element
    (STag
      (Name)
      (Attribute
        (Name)
        (AttValue))
      (Attribute
        (Name)
        (AttValue)))
    (content
      (CharData)
      (element
        (EmptyElemTag
          (Name)
          (Attribute
            (Name)
            (AttValue))
          (Attribute
            (Name)
            (AttValue))))
      (CharData)
      (element
        (STag
          (Name))
        (ETag
          (Name)))
      (CharData)
      (element
        (EmptyElemTag
          (Name)))
      (CharData))
    (ETag
      (Name))))

================================================================================
Element Declarations

:language(dtd)
================================================================================

<!ELEMENT br EMPTY>
<!ELEMENT p (#PCDATA|emph)* >
<!ELEMENT %name.para; %content.para; >
<!ELEMENT container ANY>

<!ELEMENT spec (front, body, back?)>
<!ELEMENT div1 (head, (p | list | note)*, div2*)>
<!ELEMENT dictionary-body (%div.mix; | %dict.mix;)*>

<!ELEMENT p (#PCDATA|a|ul|b|i|em)*>
<!ELEMENT p (#PCDATA | %font; | %phrase; | %special; | %form;)* >
<!ELEMENT b (#PCDATA)>

--------------------------------------------------------------------------------

(extSubset
  (elementdecl
    (Name)
    (contentspec))
  (elementdecl
    (Name)
    (contentspec
      (Mixed
        (Name))))
  (elementdecl
    (PEReference
      (Name))
    (contentspec
      (PEReference
        (Name))))
  (elementdecl
    (Name)
    (contentspec))
  (elementdecl
    (Name)
    (contentspec
      (children
        (Name)
        (Name)
        (Name))))
  (elementdecl
    (Name)
    (contentspec
      (children
        (Name)
        (Name)
        (Name)
        (Name)
        (Name))))
  (elementdecl
    (Name)
    (contentspec
      (children
        (PEReference
          (Name))
        (PEReference
          (Name)))))
  (elementdecl
    (Name)
    (contentspec
      (Mixed
        (Name)
        (Name)
        (Name)
        (Name)
        (Name))))
  (elementdecl
    (Name)
    (contentspec
      (Mixed
        (PEReference
          (Name))
        (PEReference
          (Name))
        (PEReference
          (Name))
        (PEReference
          (Name)))))
  (elementdecl
    (Name)
    (contentspec
      (Mixed))))

================================================================================
Attribute-List Declarations

:language(dtd)
================================================================================

<!ATTLIST termdef
          id      ID      #REQUIRED
          name    CDATA   #IMPLIED>
<!ATTLIST list
          type    (bullets|ordered|glossary)  "ordered">
<!ATTLIST form
          method  CDATA   #FIXED "POST">

--------------------------------------------------------------------------------

(extSubset
  (AttlistDecl
    (Name)
    (AttDef
      (Name)
      (TokenizedType)
      (DefaultDecl))
    (AttDef
      (Name)
      (StringType)
      (DefaultDecl)))
  (AttlistDecl
    (Name)
    (AttDef
      (Name)
      (Enumeration
        (Nmtoken)
        (Nmtoken)
        (Nmtoken))
      (DefaultDecl
        (AttValue))))
  (AttlistDecl
    (Name)
    (AttDef
      (Name)
      (StringType)
      (DefaultDecl
        (AttValue)))))

================================================================================
Entity Declarations

:language(dtd)
================================================================================

<!ENTITY Pub-Status "This is a pre-release of the
  specification.">

<!ENTITY open-hatch
         SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml">
<!ENTITY open-hatch
         PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN"
         "http://www.textuality.com/boilerplate/OpenHatch.xml">
<!ENTITY hatch-pic
         SYSTEM "../grafix/OpenHatch.gif"
         NDATA gif >

--------------------------------------------------------------------------------

(extSubset
  (GEDecl
    (Name)
    (EntityValue))
  (GEDecl
    (Name)
    (ExternalID
      (SystemLiteral
        (URI))))
  (GEDecl
    (Name)
    (ExternalID
      (PubidLiteral)
      (SystemLiteral
        (URI))))
  (GEDecl
    (Name)
    (ExternalID
      (SystemLiteral
        (URI)))
    (NDataDecl
      (Name))))

================================================================================
Conditional Sections

:language(dtd)
================================================================================

<!ENTITY % draft 'INCLUDE' >
<!ENTITY % final 'IGNORE' >
<![%draft;[
<!ELEMENT book (comments*, title, body, supplements?)>
]]>
<![%final;[
<!ELEMENT book (title, body, supplements?)>
]]>

--------------------------------------------------------------------------------

(extSubset
  (PEDecl
    (Name)
    (EntityValue))
  (PEDecl
    (Name)
    (EntityValue))
  (conditionalSect
    (PEReference
      (Name))
    (elementdecl
      (Name)
      (contentspec
        (children
          (Name)
          (Name)
          (Name)
          (Name)))))
  (conditionalSect
    (PEReference
      (Name))
    (elementdecl
      (Name)
      (contentspec
        (children
          (Name)
          (Name)
          (Name))))))
