DTD Topic Type Shell Tutorial Step 2: Delete Unwanted Domain Modules

A domain module is integrated into a DTD shell by the following bits, in order of occurrence in the DTD file:

Thus, deleting a domain module means removing all four of these bits for a given domain.

To remove the reference to the programming domain from myTopic.dtd, perform these steps:
  1. Find the declaration and reference for the %pr-d-dec; parameter entity and delete it:
    ...
    
    <!ENTITY % abbrev-d-dec     
      PUBLIC "-//OASIS//ENTITIES DITA 1.2 Abbreviated Form Domain//EN" 
             "abbreviateDomain.ent"
    >%abbrev-d-dec;
    
    <!ENTITY % pr-d-dec     
      PUBLIC "-//OASIS//ENTITIES DITA 1.2 Programming Domain//EN" 
             "programmingDomain.ent"                                              
    >%pr-d-dec;
    
    <!ENTITY % sw-d-dec     
      PUBLIC "-//OASIS//ENTITIES DITA 1.2 Software Domain//EN" 
             "softwareDomain.ent"                                                 
    >%sw-d-dec;
    
    ...
  2. Find the comment "DOMAIN EXTENSIONS", which is the section that contains the domain extension parameter entities. Find all the parameter entity references that start with "%pr-d-" and delete them, along with the leading or trailing "|" character:
    ...
    
    <!-- ============================================================= -->
    <!--                    DOMAIN EXTENSIONS                          -->
    <!-- ============================================================= -->
    <!--                    One for each extended base element, with
                            the name of the domain(s) in which the
                            extension was declared                     -->
    
    <!ENTITY % pre          "pre | 
                             %pr-d-pre; | 
                             %sw-d-pre; | 
                             %ui-d-pre;
                            ">
    <!ENTITY % keyword      "keyword | 
                             %pr-d-keyword; | 
                             %sw-d-keyword; |
                             %ui-d-keyword;
                            ">
    <!ENTITY % ph           "ph | 
                             %hi-d-ph; | 
                             %pr-d-ph; | 
                             %sw-d-ph; | 
                             %ui-d-ph;
                            ">
    <!ENTITY % term         "term | 
                             %abbrev-d-term;
                            ">
    <!ENTITY % fig          "fig |
                             %pr-d-fig; |
                             %ut-d-fig;
                            ">
    <!ENTITY % dl           "dl | 
                             %pr-d-dl;
                            ">
    <!ENTITY % index-base   "index-base | 
                             %indexing-d-index-base;
                            ">
    <!ENTITY % note         "note | 
                             %hazard-d-note;
                            ">
    
    ...
    The result of these deletions should look like this:
    ...
    
    <!-- ============================================================= -->
    <!--                    DOMAIN EXTENSIONS                          -->
    <!-- ============================================================= -->
    <!--                    One for each extended base element, with
                            the name of the domain(s) in which the
                            extension was declared                     -->
    
    <!ENTITY % pre          "pre | 
                             %sw-d-pre; | 
                             %ui-d-pre;
                            ">
    <!ENTITY % keyword      "keyword | 
                             %sw-d-keyword; |
                             %ui-d-keyword;
                            ">
    <!ENTITY % ph           "ph | 
                             %hi-d-ph; | 
                             %sw-d-ph; | 
                             %ui-d-ph;
                            ">
    <!ENTITY % term         "term | 
                             %abbrev-d-term;
                            ">
    <!ENTITY % fig          "fig |
                             %ut-d-fig;
                            ">
    <!ENTITY % dl           "dl
                            ">
    <!ENTITY % index-base   "index-base | 
                             %indexing-d-index-base;
                            ">
    <!ENTITY % note         "note | 
                             %hazard-d-note;
                            ">
    
  3. Find the comment "DOMAINS ATTRIBUTE OVERRIDE", which is the section that contains the declaration for the &included-domains; entity. Delete the reference to the &pr-d-att; 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;
                               &hazard-d-att;
                               &abbrev-d-att;
                               &pr-d-att; 
                               &sw-d-att;
                               &ui-d-att; 
      "
    >
    
    ...
    The result should be:
    ...
    
    <!-- ============================================================= -->
    <!--                    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;
                               &hazard-d-att;
                               &abbrev-d-att;
                               &sw-d-att;
                               &ui-d-att; 
      "
    >
    
    ...
  4. Find the declaration and reference to the %pr-d-def; parameter entity and delete it:
    ...
    
    <!ENTITY % ui-d-def     
      PUBLIC "-//OASIS//ELEMENTS DITA 1.2 User Interface Domain//EN" 
             "uiDomain.mod"
    >%ui-d-def;
    
    <!ENTITY % pr-d-def     
      PUBLIC "-//OASIS//ELEMENTS DITA 1.2 Programming Domain//EN" 
             "programmingDomain.mod"
    >%pr-d-def;
    
    <!ENTITY % sw-d-def     
      PUBLIC "-//OASIS//ELEMENTS DITA 1.2 Software Domain//EN" 
             "softwareDomain.mod"
    >%sw-d-def;
    
    ...
  5. Validate your test document. It should be valid if you've deleted everything correctly. Because the test document points directly to the myTopic.dtd file, any validation errors must be the result of something in the DTD file itself.

Repeat this process for each of the other domains you don't want.

Notice that the naming convention used for domain-related components makes it easy to find the bits for a given domain: just search on "domainShortName-d" where domainShortName is the short name for the domain, e.g., "pr", "ui", "sw", etc.

If you remove the programming (pr), software (sw), user interface (ui), and hazard statement (hazard) domains from this shell, the final result should look like this:
<?xml version="1.0" encoding="UTF-8"?>
<!-- ============================================================= 

     My Topic Shell
     
     Sample topic type shell demonstrating removing some domains
     and adding others.
     
     
     ============================================================= -->

<!-- ============================================================= -->
<!--                    TOPIC ENTITY DECLARATIONS                  -->
<!-- ============================================================= -->

<!-- ============================================================= -->
<!--                    DOMAIN ENTITY DECLARATIONS                 -->
<!-- ============================================================= -->


<!ENTITY % hi-d-dec     
  PUBLIC "-//OASIS//ENTITIES DITA 1.2 Highlight Domain//EN" 
         "../../base/dtd/highlightDomain.ent"
>%hi-d-dec;

<!ENTITY % xml-d-dec     
  PUBLIC "urn:pubid:example.org:doctypes:dita:modules:xml:entities" 
         "xmlDomain.ent"
>%xml-d-dec;

<!ENTITY % ut-d-dec     
  PUBLIC "-//OASIS//ENTITIES DITA 1.2 Utilities Domain//EN" 
         "../../base/dtd/utilitiesDomain.ent"                                                
>%ut-d-dec;

<!ENTITY % indexing-d-dec     
  PUBLIC "-//OASIS//ENTITIES DITA 1.2 Indexing Domain//EN" 
         "../../base/dtd/indexingDomain.ent"                                                 
>%indexing-d-dec;

<!ENTITY % abbrev-d-dec     
  PUBLIC "-//OASIS//ENTITIES DITA 1.2 Abbreviated Form Domain//EN" 
         "abbreviateDomain.ent"
>%abbrev-d-dec;

<!-- ============================================================= -->
<!--                    DOMAIN ATTRIBUTE DECLARATIONS              -->
<!-- ============================================================= -->


<!-- ============================================================= -->
<!--                    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;
                        ">
<!ENTITY % ph           "ph | 
                         %hi-d-ph;
                        ">
<!ENTITY % term         "term | 
                         %abbrev-d-term;
                        ">
<!ENTITY % fig          "fig |
                         %ut-d-fig;
                        ">
<!ENTITY % dl           "dl
                        ">
<!ENTITY % index-base   "index-base | 
                         %indexing-d-index-base;
                        ">
<!ENTITY % note         "note
                        ">

<!-- ============================================================= -->
<!--                    DOMAIN ATTRIBUTE EXTENSIONS                -->
<!-- ============================================================= -->
<!ENTITY % props-attribute-extensions  
  ""
>
<!ENTITY % base-attribute-extensions   
  ""
>


<!-- ============================================================= -->
<!--                    TOPIC NESTING OVERRIDE                     -->
<!-- ============================================================= -->

<!--                    Redefine the infotype entity to exclude 
                        other topic types and disallow nesting     -->
<!ENTITY % topic-info-types 
  "topic
  "
>


<!-- ============================================================= -->
<!--                    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;
  "
>


<!-- ============================================================= -->
<!--                    TOPIC ELEMENT INTEGRATION                  -->
<!-- ============================================================= -->

<!--                    Embed topic to get generic elements        -->
<!ENTITY % topic-type   
  PUBLIC "-//OASIS//ELEMENTS DITA 1.2 Topic//EN" 
         "../../base/dtd/topic.mod"
>
%topic-type;


<!-- ============================================================= -->
<!--                    DOMAIN ELEMENT INTEGRATION                 -->
<!-- ============================================================= -->

<!ENTITY % hi-d-def     
  PUBLIC "-//OASIS//ELEMENTS DITA 1.2 Highlight Domain//EN" 
         "../../base/dtd/highlightDomain.mod"
>%hi-d-def;

<!ENTITY % xml-d-def     
  PUBLIC "urn:pubid:example.org:doctypes:dita:modules:xml:declarations" 
         "xmlDomain.mod"
>%xml-d-def;

<!ENTITY % ut-d-def     
  PUBLIC "-//OASIS//ELEMENTS DITA 1.2 Utilities Domain//EN" 
         "../../base/dtd/utilitiesDomain.mod"
>%ut-d-def;

<!ENTITY % indexing-d-def     
  PUBLIC "-//OASIS//ELEMENTS DITA 1.2 Indexing Domain//EN" 
         "../../base/dtd/indexingDomain.mod"
>%indexing-d-def;

<!ENTITY % abbrev-d-def     
  PUBLIC "-//OASIS//ELEMENTS DITA 1.2 Abbreviated Form Domain//EN" 
         "abbreviateDomain.mod"
>%abbrev-d-def;


<!-- ================== End My Topic DTD  ====================== -->
Note that in the domain extension area, there are now declarations like this:
<!ENTITY % pre          "pre
                        ">

Which is just defining %pre; to be "pre", which is effectively doing nothing to the original definition of %pre;. However, it doesn't hurt to have it here and it gives you a ready place to add in any new domains you might integrate later. You can remove this declaration entirely if you want.