DTD Topic Type Shell Tutorial Step 3: Add Reference to a New Domain

For this tutorial we will to integrate the XML domain defined in Element Domain Specialization Tutorial.
Note: You can get the worked result of that tutorial from the tutorial materials.
To integrate a new domain, we add the following four components:
For a given domain to be integrated you need to know the following:
We want to integrate the XML domain defined in the Element Domain Specialization tutorial. The information we need for the XML domain is:
.ent file public ID
"urn:pubid:example.org:doctypes:dita:modules:xml:entities"
.mod file public ID
"urn:pubid:example.org:doctypes:dita:modules:xml:declarations"
domain extension parameter entities
%xml-d-keyword;
domains attribute text entity
&xml-d-att;
Armed with this knowledge, the process of integrating the domain is as follows:
  1. Find the declaration and reference for the %hi-d-dec; parameter entity. Copy it and paste a new copy into myTopic.dtd immediately after the original:
    ...
    
    <!-- ============================================================= -->
    <!--                    DOMAIN ENTITY DECLARATIONS                 -->
    <!-- ============================================================= -->
    
    
    <!ENTITY % hi-d-dec     
      PUBLIC "-//OASIS//ENTITIES DITA 1.2 Highlight Domain//EN" 
             "../../base/dtd/highlightDomain.ent"
    >%hi-d-dec;
    
    <!ENTITY % hi-d-dec     
      PUBLIC "-//OASIS//ENTITIES DITA 1.2 Highlight Domain//EN" 
             "../../base/dtd/highlightDomain.ent"
    >%hi-d-dec;
    
    ...
  2. In the copy, change "hi-d-dec" to "xml-d-dec" in both places where it occurs:
    <!ENTITY % xml-d-dec     
      PUBLIC "-//OASIS//ENTITIES DITA 1.2 Highlight Domain//EN" 
             "../../base/dtd/highlightDomain.ent"
    >%xml-d-dec;
  3. Replace the public identifier string with the URN for the XML domain:
    <!ENTITY % xml-d-dec     
      PUBLIC "urn:pubid:example.org:doctypes:dita:modules:xml:entities" 
             "../../base/dtd/highlightDomain.ent"
    >%xml-d-dec;
  4. Replace the system identifier with "xmlDomain.ent":
    <!ENTITY % xml-d-dec     
      PUBLIC "urn:pubid:example.org:doctypes:dita:modules:xml:entities" 
             "xmlDomain.ent"
    >%xml-d-dec;
  5. Find the comment "DOMAIN EXTENSIONS" and add a reference to the %xml-d-keyword; parameter entity to the declaration of the %keyword; parameter entity:
    ...
    
    <!-- ============================================================= -->
    <!--                    DOMAIN EXTENSIONS                          -->
    <!-- ============================================================= -->
    <!--                    One for each extended base element, with
                            the name of the domain(s) in which the
                            extension was declared                     -->
    
    <!ENTITY % pre          "pre
                            ">
    <!ENTITY % keyword      "keyword |
                             %xml-d-keyword;
                            ">
    
    ...

    Note the leading "|" character added after "keyword " in the original declaration. This parameter entity is used to build up an OR group of element type names, so you need to add the "|" (OR) connector between "keyword" and "%xml-d-keyword;".

    Tip: Common error: If you forget the "|" character or accidentally leave one out you will get validation errors that may be cryptic or misleading, because they will often point to the declarations for elements somewhere deep in the DITA declaration sets, usually the first element type encountered that happens to use the parameter entity you just modified. When you get this type of error, the first thing to check is your domain extension parameter entities—that is likely the cause of the error, especially if you are integrating pre-existing domains that you know are otherwise valid.
  6. Find the comment "DOMAINS ATTRIBUTE OVERRIDE" and then the declaration for the &included-domains; text entity. Add a reference to the &xml-d-att; text entity:
    ...
    
    <!-- ============================================================= -->
    <!--                    DOMAINS ATTRIBUTE OVERRIDE                 -->
    <!-- ============================================================= -->
    <!--                    Must be declared ahead of the DTDs, which
                            puts @domains first in order               -->
    
    <!ENTITY included-domains 
                              "&hi-d-att; 
                               &ut-d-att; 
                               &indexing-d-att;
                               &abbrev-d-att;
                               &xml-d-att;
      "
    >
    
    ...
  7. Find the declaration and reference for the %hi-d-def; parameter entity. Copy it and paste a new copy immediately after the original:
    ...
    
    <!-- ============================================================= -->
    <!--                    DOMAIN ELEMENT INTEGRATION                 -->
    <!-- ============================================================= -->
    
    <!ENTITY % hi-d-def     
      PUBLIC "-//OASIS//ELEMENTS DITA 1.2 Highlight Domain//EN" 
             "../../base/dtd/highlightDomain.mod"
    >%hi-d-def;
    
    <!ENTITY % hi-d-def     
      PUBLIC "-//OASIS//ELEMENTS DITA 1.2 Highlight Domain//EN" 
             "../../base/dtd/highlightDomain.mod"
    >%hi-d-def;
    
    ...
  8. Change "hi-d-def" to "xml-d-def" everywhere it occurs:
    <!ENTITY % xml-d-def     
      PUBLIC "-//OASIS//ELEMENTS DITA 1.2 Highlight Domain//EN" 
             "../../base/dtd/highlightDomain.mod"
    >%xml-d-def;
  9. Change the public identifier to the public ID for xmlDomain.mod:
    <!ENTITY % xml-d-def     
      PUBLIC "urn:pubid:example.org:doctypes:dita:modules:xml:declarations" 
             "../../base/dtd/highlightDomain.mod"
    >%xml-d-def;
    Tip: Common error: If you are copy the public ID or URN from a catalog file, it is easy to accidently copy the public ID for the .ent file instead of for the .mod file and visa versa. If you get mysterious errors, like duplicate declaration messages or "element type note declared" messages even though you know you included the module, check the public ID value to make sure you didn't mix up the .ent and .mod public IDs.
  10. Change the system identifier to "xmlDomain.mod":
    <!ENTITY % xml-d-def     
      PUBLIC "urn:pubid:example.org:doctypes:dita:modules:xml:declarations" 
             "xmlDomain.mod"
    >%xml-d-def;
  11. Validate your test document. Assuming that the XML domain module is already deployed (you can find it in the materials package for the tutorials), then your document should validate if you haven't made any syntax errors in the shell DTD.

    If the document validates, see if you can enter any of the element types from the domain, such as <xmlelem> or <xmlatt>, into a paragraph. You should be able to.

That's it, you're done. You've successfully created a new topic type shell that removes domains you don't want and adds a new domain you do want.

It should be clear from following this tutorial that creating document type shells is an entirely mechanical process and that once you've done it once or twice it becomes very easy and quick.

This tutorial did not show how to package your new shell as a Toolkit plugin. For that, see Packaging Document Type Shells and Vocabulary Modules as Toolkit Plugins.

This tutorial shows how to create a topic type shell. Creating map type shells is exactly the same.