XSD Topic Type Shell Tutorial Step 2: Remove References to Unwanted Domain Modules

Within an XSD document type shell, a given domain module is integrated by the following bits:
  • An include of the domain's XSD file (XSD domain modules consist of a single XSD file, rather than the two files needed for DTD domain modules or topic and map XSD modules).
  • References to the domain's domain extension groups within the redefine for the commonElementMod.xsd document (or the module that contains the declaration of the base type being extended).
  • The domains attribute value component for the domain, added to the definition of the @domains attribute value in the XSD shell (unlike DTDs, there is no way to parameterize the value of an attribute in XSD schemas).
To remove the programming domain from the myTopic.xsd shell, do the following:
  1. Find the <xs:include> element for the programmingDomain.xsd file and delete it or comment it out:
      ...
    
      <!--  ================ TOPIC DOMAINS =====================  -->
      <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:uiDomain.xsd:1.2"/>
      <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:softwareDomain.xsd:1.2"/>
      <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:highlightDomain.xsd:1.2"/>
      <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:programmingDomain.xsd:1.2"/>
      <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:utilitiesDomain.xsd:1.2"/>
      <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:indexingDomain.xsd:1.2"/>
      <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:hazardstatementDomain.xsd:1.2"/>
      <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:abbreviateDomain.xsd:1.2" />
    
      ...
  2. Find all the <xs:group> elements that refer to a group starting with "pr-d-" and delete them:
      ...
      
      <xs:redefine schemaLocation="urn:oasis:names:tc:dita:xsd:commonElementGrp.xsd:1.2">
        <xs:group name="keyword">
          <xs:choice>
            <xs:group ref="keyword"/>
            <xs:group ref="pr-d-keyword" />
            <xs:group ref="ui-d-keyword" />
            <xs:group ref="sw-d-keyword" />
          </xs:choice>
        </xs:group>
    
        <xs:group name="ph">
          <xs:choice>
            <xs:group ref="ph"/>
            <xs:group ref="pr-d-ph" />
            <xs:group ref="ui-d-ph" />
            <xs:group ref="hi-d-ph" />
            <xs:group ref="sw-d-ph" />
          </xs:choice>
        </xs:group>
    
        <xs:group name="pre">
          <xs:choice>
            <xs:group ref="pre"/>
            <xs:group ref="pr-d-pre" />
            <xs:group ref="ui-d-pre" />
            <xs:group ref="sw-d-pre" />
          </xs:choice>
        </xs:group>
    
    
        <xs:group name="dl">
          <xs:choice>
            <xs:group ref="dl"/>
            <xs:group ref="pr-d-dl"/>
          </xs:choice >
        </xs:group >
    
    
        <xs:group name="fig">
          <xs:choice>
            <xs:group ref="fig"/>
            <xs:group ref="pr-d-fig"/>
            <xs:group ref="ut-d-fig" />
          </xs:choice>
        </xs:group >
      
        <xs:group name="index-base">
          <xs:choice>
            <xs:group ref="index-base"/>
            <xs:group ref="indexing-d-index-base"/>
          </xs:choice>
        </xs:group >
          
        <xs:group name="note">
          <xs:choice>
            <xs:group ref="note"/>
            <xs:group ref="hazard-d-note"/>
          </xs:choice>
        </xs:group >
        
        <xs:group name="term">
          <xs:choice>
            <xs:group ref="term"/>
            <xs:group ref="abbrev-d-term"/>
          </xs:choice>
        </xs:group >
        
      </xs:redefine>
    
      ...
  3. Find the declaration for the "domains-att" attribute group and delete "(topic pr-d)" from the value:
      <xs:attributeGroup name="domains-att">
        <xs:attribute name="domains" type="xs:string"       
          default="(topic ui-d) (topic hi-d) (topic sw-d) 
          (topic pr-d) (topic ut-d) (topic indexing-d) 
          (topic hazard-d) (topic abbrev-d)"/>
      </xs:attributeGroup>
  4. Validate your test document. It should still be valid.

    Because XSD uses normal XML markup it's harder to introduce syntax errors than when modifying DTDs, so it's unlikely you would have an invalid shell after following these steps. The most likely error would be failing to remove a reference to a domain extension group, but an XSD-aware editor like OxygenXML will flag a reference to a group that isn't defined (in this case, because you would have already deleted the reference to the domain's XSD file, which defines domain extension groups).

Repeat this process for the software, user interface, and hazard domains.

The resulting myTopic.xsd file should look like this:
<?xml version="1.0" encoding="UTF-8"?>
<!-- ============================================================= 
     My Topic Shell
     
     Shell that demonstrates adding and removing domains.
     ============================================================= -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/">
  
  <!-- Add the domains to the base topic XML Schema -->
  <!--  ================ TOPIC DOMAINS =====================  -->
  <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:highlightDomain.xsd:1.2"/>
  <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:utilitiesDomain.xsd:1.2"/>
  <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:indexingDomain.xsd:1.2"/>
  <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:abbreviateDomain.xsd:1.2" />
  
  
  <!--  ================ GROUP DEFINITIONS =====================  -->
  <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:metaDeclGrp.xsd:1.2"/>
  <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:tblDeclGrp.xsd:1.2"/>
  <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:topicGrp.xsd:1.2"/>
  
  <!-- =================  MODULE INLCUDE DEFINITION  ==================  -->
  <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:commonElementMod.xsd:1.2"/>
  <!-- ======== Table elements ======== -->
  <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:tblDeclMod.xsd:1.2"/>    
  <!-- ======= MetaData elements, plus keyword and indexterm ======= -->
  <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:metaDeclMod.xsd:1.2"/>
  
  <xs:redefine schemaLocation="urn:oasis:names:tc:dita:xsd:commonElementGrp.xsd:1.2">
    <xs:group name="keyword">
      <xs:choice>
        <xs:group ref="keyword"/>
      </xs:choice>
    </xs:group>

    <xs:group name="ph">
      <xs:choice>
        <xs:group ref="ph"/>
        <xs:group ref="hi-d-ph" />
      </xs:choice>
    </xs:group>

    <xs:group name="pre">
      <xs:choice>
        <xs:group ref="pre"/>
      </xs:choice>
    </xs:group>


    <xs:group name="dl">
      <xs:choice>
        <xs:group ref="dl"/>
      </xs:choice >
    </xs:group >


    <xs:group name="fig">
      <xs:choice>
        <xs:group ref="fig"/>
        <xs:group ref="ut-d-fig" />
      </xs:choice>
    </xs:group >
  
    <xs:group name="index-base">
      <xs:choice>
        <xs:group ref="index-base"/>
        <xs:group ref="indexing-d-index-base"/>
      </xs:choice>
    </xs:group >
      
    <xs:group name="note">
      <xs:choice>
        <xs:group ref="note"/>
      </xs:choice>
    </xs:group >
    
    <xs:group name="term">
      <xs:choice>
        <xs:group ref="term"/>
        <xs:group ref="abbrev-d-term"/>
      </xs:choice>
    </xs:group >
    
    </xs:redefine>


  <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:topicMod.xsd:1.2"/>


  <xs:group name="info-types">
    <xs:sequence/>    
  </xs:group>
  
  <xs:attributeGroup name="domains-att">
    <xs:attribute name="domains" type="xs:string"       
      default="(topic abbrev-d)
      (topic hi-d)  
      (topic indexing-d) 
      (topic ut-d) 
      "/>
  </xs:attributeGroup>

</xs:schema>