Step 2-3. Declare Elements and Attributes

For each element type, create an element type and attribute declaration:
<!-- ====================================================
     XML Construct Domain Module
    
     Author: your name here

     Copyright (c) 2011 copyright holder
     
     license to use or not use or whatever
     ==================================================== -->
 
<!ENTITY % xmlelem    "xmlelem"  >

<!--                    LONG NAME: XML Element                            -->
<!ENTITY % xmlelem.content 
  " 
  (#PCDATA)*
  "
>
<!ENTITY % xmlelem.attributes
  '
  %univ-atts;          
  keyref
    CDATA
    #IMPLIED
  outputclass 
    CDATA
    #IMPLIED    
  '
>
<!ELEMENT xmlelem %xmlelem.content; >
<!ATTLIST xmlelem %xmlelem.attributes; >
          

Note that the content model for each element type must be at least as restrictive as the content model of the specialization base (in this case, <keyword>, although we haven't declared that yet). Looking at the DITA language reference (or the declaration in commonElements.mod), we see that the content model for <keyword> includes both #PCDATA as well as all other phrase-level elements. Since the XML component mentions don't need or want any subelements, we've reduced the content model down to just #PCDATA (just text), which is consistent with the content model of the <keyword> element.

Note also that the content model and attribute lists are defined as parameter entities that are then used in the actual ELEMENT and ATTLIST declarations. (This is a change from DITA 1.1 to DITA 1.2 made to enable overriding of individual element's content models and attribute lists through constraint modules. ) In this case the only content model more restrictive than "(#PCDATA)*" is "EMPTY".)