<?xml version='1.0' encoding='utf-8'?>
<!-- This file is part of the DITA Open Toolkit project hosted on 
     Sourceforge.net. See the accompanying license.txt file for 
     applicable licenses.-->
<!-- (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved. -->

<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="domains" xml:lang="en-us">
  <title>Specializing domains in DITA</title>
  <shortdesc>In current approaches, DTDs are static. As a result, DTD designers try to cover every contingency and, when this effort fails, users have to force their information to fit existing types. DITA changes this situation by giving information architects and developers the power to extend a base DTD to cover their domains.</shortdesc>
  <prolog>
    <author>Erik Hennum; IBM Corporation; ehennum@us.ibm.com. Erik Hennum works on the design and implementation of User Assistance for the IBM Storage Systems Group.</author>
  </prolog>
  <body>
    <p>The Darwin Information Typing Architecture (DITA) is an XML architecture for extensible technical information. A domain extends DITA with a set of elements whose names and content models are unique to an organization or field of knowledge. Architects and authors can combine elements from any number of domains, leading to great flexibility and precision in capturing the semantics and structure of their information. In this overview, you learn how to define your own domains.</p>
  </body>  <topic id="intro">
    <title>Introducing domain specialization</title>
    <body>
      <p>In DITA, the topic is the basic unit of processable content. The topic provides the title, metadata, and structure for the content. Some topic types provide very simple content structures. For example, the <apiname>concept</apiname> topic has a single concept body for all of the concept content. By contrast, a <apiname>task</apiname> topic articulates a structure that distinguishes pieces of the task content, such as the prerequisites, steps, and results.</p>
      <p>In most cases, these topic structures contain content elements that are not specific to the topic type. For example, both the concept body and the task prerequisites permit common block elements such as <apiname>p</apiname> paragraphs and <apiname>ul</apiname> unordered lists.</p>
      <p><term>Domain specialization</term> lets you define new types of content elements independently of topic type. That is, you can derive new phrase or block elements from the existing phrase and block elements. You can use a specialized content element within any topic structure where its base element is allowed. For instance, because a <apiname>p</apiname> paragraph can appear within a concept body or task prerequisite, a specialized paragraph could appear there, too.</p>
      <fig>
        <image href="image/content_special.gif" alt="specialized content can be inserted in topic bodies" height="125" width="406"/>
        <p>Here&apos;s an analogy from the kitchen. You might think of topics as types of containers for preparing food in different ways, such as a basic frying pan, blender, and baking dish. The content elements are like the ingredients that go into these containers, such as spices, flour, and eggs. The domain resembles a specialty grocer who provides ingredients for a particular cuisine. Your pot might contain chorizo from the carnicería when you&apos;re cooking TexMex or risotto when you&apos;re cooking Italian. Similarly, your topics can contain elements from the programming domain when you&apos;re writing about a programming language or elements from the UI domain when you&apos;re writing about a GUI application.</p>
        <p>DITA has broad tastes, so you can mix domains as needed. If you&apos;re describing how to program GUI applications, your topics can draw on elements from both the programming and UI domains. You can also create new domains for <i>your</i> content. For instance, a new domain could provide elements for describing hardware devices. You can also reuse new domains created by others, expanding the variety of what you can cook up.</p>
        <p>In a more formal definition, topic specialization starts with the containing element and works from the top down. Domain specialization, on the other hand, starts with the contained element and works from the bottom up.</p>
      </fig>
    </body>
  </topic>
  <topic id="base">
    <title>Understanding the base domains</title>
    <body>
      <p>A DITA <term>domain</term> collects a set of specialized content elements for some purpose. In effect, a domain provides a specialized vocabulary. With the base DITA package, you receive the following domains:</p>
      <table>
        <tgroup cols="2">
          <thead>
            <row>
              <entry>Domain</entry>
              <entry>Purpose</entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry>highlight</entry>
              <entry>To highlight text with styles such as bold, italic, and monospace</entry>
            </row>
            <row>
              <entry>programming</entry>
              <entry>To define the syntax and give examples of programming languages</entry>
            </row>
            <row>
              <entry>software</entry>
              <entry>To describe the operation of a software program</entry>
            </row>
            <row>
              <entry>UI</entry>
              <entry>To describe the user interface of a software program</entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <p>In most domains, a specialized element adds semantics to the base element. For example, the <apiname>apiname</apiname> element of the programming domain extends the basic <apiname>keyword</apiname> element with the semantic of a name within an API.</p>
      <p>The highlight domain is a special case. The elements in this domain provide styled presentation instead of semantic or structural markup. The highlight styles give authors a practical way to mark up phrases for which a semantic has not been defined. </p>
      <p>Providing such highlight styles through a domain resolves a long-standing dispute for publication DTDs. Purists can omit the highlight domain to enforce documents that should be strictly semantic. Pragmatists can include the highlight domain to provide expressive flexibility for real-world authoring. A semipragmatist could even include the highlight domain in conceptual documents to support expressive authoring but omit the highlight domain from reference documents to enforce strict semantic tagging. </p>
      <p>More generally, you can define documents with any combination of domains and topics. As we&apos;ll see in <xref href="#generalize" type="topic"/>, the resulting documents can still be exchanged.</p>
    </body>
  </topic>
  <topic id="combine">
    <title>Combining an existing topic and domain</title>
    <body>
      <p>The DITA package provides a DTD for each topic type and an omnibus DTD (<filepath>ditabase.dtd</filepath>) that defines all of the topic types. Each of these DTDs includes all of the predefined DITA domains. Thus, topics written against one of the supplied DTDs can use all of the predefined domain specializations.</p>
      <p>Behind the scenes, a DITA DTD is just a shell. Elements are actually defined in other modules, which are included in the DTD. Through these modules, DITA provides you with the building blocks to create new combinations of topic types and domains.</p>
      <p>When you add a domain to your DITA installation, the new domain provides you with additional modules. You can use the additional modules to incorporate the domain into the existing DTDs or to create new DTDs.</p>
      <p>In particular, each domain is implemented with two files:</p>
      <ul>
        <li>
          <p>A file that declares the entities for the domain. This file has the <filepath>.ent</filepath> extension.</p>
        </li>
        <li>
          <p>A file that declares the elements for the domain. This file has the <filepath>.mod</filepath> extension.</p>
        </li>
      </ul>
      <p>As an example, let&apos;s say we&apos;re authoring the reference topics for a programming language. We&apos;re purists about presentation, so we want to exclude the highlight domain. We also have no need for the software or UI domains in this reference. We could address this scenario by defining a new shell DTD that combines the reference topic with the programming domain, excluding the other domains. </p>
      <p>A shell DTD has a consistent design pattern with a few well-defined sections. The instructions in these sections perform the following actions:</p>
      <ol>
        <li>
          <p>Declare the entities for the domains.</p>
          <p>In the scenario, this section would include the programming domain entities:</p>
          <codeblock>&lt;!ENTITY % pr-d-dec PUBLIC &quot;-//IBM//ENTITIES DITA Programming Domain//EN&quot; &quot;programming-domain.ent&quot;&gt;
  %pr-d-dec;
</codeblock>
        </li>
        <li>
          <p>Redefine the entities for the base content elements to add the specialized content elements from the domains.</p>
          <p>This section is crucial for domain specialization. Here, the design pattern makes use of two kinds of entities. Each base content element has an <term>element entity</term> to identify itself and its specializations. Each domain provides a separate <term>domain specialization entity</term> to list the specializations that it provides for a base element. By combining the two kinds of entities, the shell DTD allows the specialized content elements to be used in the same contexts as the base element.</p>
          <p>In the scenario, the <apiname>pre</apiname> element entity identifies the <apiname>pre</apiname> element (which, as in HTML, contains preformatted text) and its specializations. The programming domain provides the <apiname>pr-d-pre</apiname> domain specialization entity to list the specializations for the <apiname>pre</apiname> base element. The same pattern is used for the other base elements specialized by the programming domain:</p>
          <codeblock>&lt;!ENTITY % pre     &quot;pre     | %pr-d-pre;&quot;&gt;
&lt;!ENTITY % keyword &quot;keyword | %pr-d-keyword;&quot;&gt;
&lt;!ENTITY % ph      &quot;ph      | %pr-d-ph;&quot;&gt;
&lt;!ENTITY % fig     &quot;fig     | %pr-d-fig;&quot;&gt;
&lt;!ENTITY % dl      &quot;dl      | %pr-d-dl;&quot;&gt;
</codeblock>
          <p>To learn which content elements are specialized by a domain, you can look at the entity declaration file for the domain.</p>
        </li>
        <li>
          <p>Define the <apiname>domains</apiname> attribute of the topic elements to declare the domains represented in the document.</p>
          <p>Like the <apiname>class</apiname> attribute, the <apiname>domains</apiname> attribute identifies dependencies. Where the <apiname>class</apiname> attribute identifies base elements, the <apiname>domains</apiname> attribute identifies the domains available within a topic. Each domain provides a <term>domain identification entity</term> to identify itself in the <apiname>domains</apiname> attribute.</p>
          <p>In the scenario, the only topic is the <apiname>reference</apiname> topic. The only domain is the programming domain, which is identified by the <codeph>pr-d-att</codeph> domain identification entity:</p>
          <codeblock>&lt;!ATTLIST reference  domains CDATA &quot;&amp;pr-d-att;&quot;&gt;
</codeblock>
        </li>
        <li>
          <p>Redefine the infotypes entity to specify the topic types that can be nested within a topic.</p>
          <p>In the scenario, this section would declare the <apiname>reference</apiname> topic:</p>
          <codeblock>&lt;!ENTITY % info-types &quot;reference&quot;&gt;
</codeblock>
        </li>
        <li>
          <p>Define the elements for the topic type, including the base topics.</p>
          <p>In the scenario, this section would include the base topic and reference topic modules:</p>
          <codeblock>&lt;!ENTITY % topic-type PUBLIC &quot;-//IBM//ELEMENTS DITA Topic//EN&quot; &quot;topic.mod&quot;&gt;
  %topic-type;
&lt;!ENTITY % reference-typemod PUBLIC &quot;-//IBM//ELEMENTS DITA Reference//EN&quot; &quot;reference.mod&quot;&gt;
  %reference-typemod;
</codeblock>
        </li>
        <li>
          <p>Define the elements for the domains.</p>
          <p>In the scenario, this section would include the programming domain definition module:</p>
          <codeblock>&lt;!ENTITY % pr-d-def PUBLIC &quot;-//IBM//ELEMENTS DITA Programming Domain//EN&quot; &quot;programming-domain.mod&quot;&gt;
  %pr-d-def;
</codeblock>
        </li>
      </ol>
      <p>Often, it would be easiest to work by copying an existing DTD and adding or removing topics or domains. In the scenario, it would be easiest to start with <filepath>reference.dtd</filepath> and remove the highlight, software, and UI domains as shown with the underlined text below.</p>
      <codeblock>&lt;!--vocabulary declarations--&gt;
<u>&lt;!ENTITY % ui-d-dec PUBLIC &quot;-//IBM//ENTITIES DITA User Interface Domain//EN&quot; &quot;ui-domain.ent&quot;&gt;
  %ui-d-dec;
&lt;!ENTITY % hi-d-dec PUBLIC &quot;-//IBM//ENTITIES DITA Highlight Domain//EN&quot; &quot;highlight-domain.ent&quot;&gt;
  %hi-d-dec;</u>
&lt;!ENTITY % pr-d-dec PUBLIC &quot;-//IBM//ENTITIES DITA Programming Domain//EN&quot; &quot;programming-domain.ent&quot;&gt;
  %pr-d-dec;
<u>&lt;!ENTITY % sw-d-dec PUBLIC &quot;-//IBM//ENTITIES DITA Software Domain//EN&quot; &quot;software-domain.ent&quot;&gt;
  %sw-d-dec;</u>

&lt;!--vocabulary substitution--&gt;
&lt;!ENTITY % pre     &quot;pre     | %pr-d-pre;     <u>| %sw-d-pre;</u>&quot;&gt;
&lt;!ENTITY % keyword &quot;keyword | %pr-d-keyword; <u>| %sw-d-keyword; | %ui-d-keyword;</u>&quot;&gt;
&lt;!ENTITY % ph      &quot;ph      | %pr-d-ph;      <u>| %sw-d-ph;      | %hi-d-ph; | %ui-d-ph;</u>&quot;&gt;
&lt;!ENTITY % fig     &quot;fig     | %pr-d-fig;&quot;&gt;
&lt;!ENTITY % dl      &quot;dl      | %pr-d-dl;&quot;&gt;

&lt;!--vocabulary attributes--&gt;
&lt;!ATTLIST reference  domains CDATA &quot;<u>&amp;ui-d-att; &amp;hi-d-att;</u> &amp;pr-d-att; <u>&amp;sw-d-att;</u>&quot;&gt;

&lt;!--Redefine the infotype entity to exclude other topic types--&gt;
&lt;!ENTITY % info-types &quot;reference&quot;&gt;

&lt;!--Embed topic to get generic elements --&gt;
&lt;!ENTITY % topic-type PUBLIC &quot;-//IBM//ELEMENTS DITA Topic//EN&quot; &quot;topic.mod&quot;&gt;
  %topic-type;

&lt;!--Embed reference to get specific elements --&gt;
&lt;!ENTITY % reference-typemod PUBLIC &quot;-//IBM//ELEMENTS DITA Reference//EN&quot; &quot;reference.mod&quot;&gt;
  %reference-typemod;

&lt;!--vocabulary definitions--&gt;
<u>&lt;!ENTITY % ui-d-def PUBLIC &quot;-//IBM//ELEMENTS DITA User Interface Domain//EN&quot; &quot;ui-domain.mod&quot;&gt;
  %ui-d-def;
&lt;!ENTITY % hi-d-def PUBLIC &quot;-//IBM//ELEMENTS DITA Highlight Domain//EN&quot; &quot;highlight-domain.mod&quot;&gt;
  %hi-d-def;</u>
&lt;!ENTITY % pr-d-def PUBLIC &quot;-//IBM//ELEMENTS DITA Programming Domain//EN&quot; &quot;programming-domain.mod&quot;&gt;
  %pr-d-def;
<u>&lt;!ENTITY % sw-d-def PUBLIC &quot;-//IBM//ELEMENTS DITA Software Domain//EN&quot; &quot;software-domain.mod&quot;&gt;
  %sw-d-def;</u>
</codeblock>
    </body>
  </topic>
  <topic id="new">
    <title>Creating a domain specialization</title>
    <body>
      <p>For some documents, you may need new types of content elements. In a common scenario, you need to mark up phrases that have special semantics. You can handle such requirements by creating new specializations of existing content elements and providing a domain to reuse the new content elements within topic structures.</p>
      <p>As an example, let&apos;s say we&apos;re writing the documentation for a class library. We intend to write processes that will index the documentation by class, field, and method. To support this processing, we need to mark up the names of classes, fields, and methods within the topic content, as in the following sample: </p>
      <codeblock>&lt;p&gt;The &lt;classname&gt;String&lt;/classname&gt; class provides
the &lt;fieldname&gt;length&lt;/fieldname&gt; field and 
the &lt;methodname&gt;concatenate()&lt;/methodname&gt; method.
&lt;/p&gt;</codeblock>
      <p>We must define new content elements for these names. Because the names are special types of names within an API, we can specialize the new elements from the <apiname>apiname</apiname> element provided by the programming domain.</p>
      <p>The design pattern for a domain requires an abbreviation to represent the domain. A sensible abbreviation for the class library domain might be <codeph>cl</codeph>. The identifier for a domain consists of the abbreviation followed by <codeph>-d</codeph> (for domain).</p>
      <p>As noted in <xref href="#combine" type="topic"/>, the domain requires an entity declaration file and an element definition file.</p>
      <section>
        <title>Writing the entity declaration file</title>
        <p>The entity declaration file has sections that perform the following actions:</p>
        <ol>
          <li>
            <p>Define the domain specialization entities.</p>
            <p>A domain specialization entity lists the specialized elements provided by the domain for a base element. For clarity, the entity name is composed of the domain identifier and the base element name. The domain provides domain specialization entities for ancestor elements as well as base elements.</p>
            <p>In the scenario, the domain defines a domain specialization entity for the <apiname>apiname</apiname> base element as well as the <apiname>keyword</apiname> ancestor element (which is the base element for <apiname>apiname</apiname>):</p>
            <codeblock>&lt;!ENTITY % cl-d-apiname &quot;classname | fieldname | methodname&quot;&gt;
&lt;!ENTITY % cl-d-keyword &quot;classname | fieldname | methodname&quot;&gt;
</codeblock>
          </li>
          <li>
            <p> Define the domain identification entity.</p>
            <p>The domain identification entity lists the topic type as well as the domain and other domains for which the current domain has dependencies. Each domain is identified by its domain identifier. The list is enclosed in parentheses. For clarity, the entity name is composed of the domain identifier and <codeph>-att</codeph>.</p>
            <p>In the scenario, the class library domain has a dependency on the programming domain, which provides the <apiname>apiname</apiname> element:</p>
            <codeblock>&lt;!ENTITY cl-d-att &quot;(topic pr-d cl-d)&quot;&gt;</codeblock>
          </li>
        </ol>
        <p>The complete entity declaration file would look as follows:</p>
        <codeblock>&lt;!ENTITY % cl-d-apiname &quot;classname | fieldname | methodname&quot;&gt;
&lt;!ENTITY % cl-d-keyword &quot;classname | fieldname | methodname&quot;&gt;

&lt;!ENTITY cl-d-att &quot;(topic pr-d cl-d)&quot;&gt;
</codeblock>
      </section>
      <section>
        <title>Writing the element definition file</title>
        <p>The element definition file has sections that perform the following actions:</p>
        <ol>
          <li>
            <p>Define the content element entities for the elements introduced by the domain.</p>
            <p>These entities permit other domains to specialize from the elements of the current domain.</p>
            <p>In the scenario, the class library domain follows this practice so that additional domains can be added in the future. The domain defines entities for the three new elements:</p>
            <codeblock>&lt;!ENTITY % classname  &quot;classname&quot;&gt;
&lt;!ENTITY % fieldname  &quot;fieldname&quot;&gt;
&lt;!ENTITY % methodname &quot;methodname&quot;&gt;
</codeblock>
          </li>
          <li>
            <p> Define the elements.</p>
            <p>The specialized content model must be consistent with the content model for the base element. That is, any possible contents of the specialized element must be generalizable to valid contents for the base element. Within that limitation, considerable variation is possible. Specialized elements can be substituted for elements in the base content model. Optional elements can be omitted or required. An element with multiple occurrences can be replaced with a list of specializations of that element, and so on.</p>
            <p>The specialized content model should always identify elements through the element entity rather than directly by name. This practice lets other domains merge their specializations into the current domain.</p>
            <p>In the scenario, the elements have simple character content:</p>
            <codeblock>&lt;!ELEMENT classname        (#PCDATA)&gt;
&lt;!ELEMENT fieldname        (#PCDATA)&gt;
&lt;!ELEMENT methodname       (#PCDATA)&gt;
</codeblock>
          </li>
          <li>
            <p>Define the specialization hierarchy for the element with <apiname>class</apiname> attribute.</p>
            <p>For a domain element, the value of the attribute must start with a plus sign. Elements provided by domains should be qualified by the domain identifier.</p>
            <p>In the scenario, specialization hierarchies include the <apiname>keyword</apiname> ancestor element provided by the base topic and the <apiname>apiname</apiname> element provided by the programming domain:</p>
            <codeblock>&lt;!ATTLIST classname      class CDATA &quot;+ topic/keyword pr-d/apiname cl-d/classname &quot;&gt;
&lt;!ATTLIST fieldname      class CDATA &quot;+ topic/keyword pr-d/apiname cl-d/fieldname &quot;&gt;
&lt;!ATTLIST methodname     class CDATA &quot;+ topic/keyword pr-d/apiname cl-d/methodname &quot;&gt;
</codeblock>
          </li>
        </ol>
        <p>The complete element definition file would look as follows:</p>
        <codeblock>&lt;!ENTITY % classname  &quot;classname&quot;&gt;
&lt;!ENTITY % fieldname  &quot;fieldname&quot;&gt;
&lt;!ENTITY % methodname &quot;methodname&quot;&gt;

&lt;!ELEMENT classname        (#PCDATA)&gt;
&lt;!ELEMENT fieldname        (#PCDATA)&gt;
&lt;!ELEMENT methodname       (#PCDATA)&gt;

&lt;!ATTLIST classname      class CDATA &quot;+ topic/keyword pr-d/apiname cl-d/classname &quot;&gt;
&lt;!ATTLIST fieldname      class CDATA &quot;+ topic/keyword pr-d/apiname cl-d/fieldname &quot;&gt;
&lt;!ATTLIST methodname     class CDATA &quot;+ topic/keyword pr-d/apiname cl-d/methodname &quot;&gt;
</codeblock>
      </section>
      <section>
        <title>Writing the shell DTD</title>
        <p>After creating the domain files, you can write shell DTDs to combine the domain with topics and other domains. The shell DTD must include all domain dependencies. </p>
        <p>In the scenario, the shell DTD combines the class library domain with the concept, reference, and task topics and the programming domain. The portions specific to the class library domain are highlighted below in bold:</p>
        <codeblock>&lt;!--vocabulary declarations--&gt;
&lt;!ENTITY % pr-d-dec PUBLIC &quot;-//IBM//ENTITIES DITA Programming Domain//EN&quot; &quot;programming-domain.ent&quot;&gt;
  %pr-d-dec;
<b>&lt;!ENTITY % cl-d-dec SYSTEM &quot;classlib-domain.ent&quot;&gt; %cl-d-dec;</b>

&lt;!--vocabulary substitution--&gt;
&lt;!ENTITY % pre     &quot;pre     | %pr-d-pre;&quot;&gt;
&lt;!ENTITY % keyword &quot;keyword | %pr-d-keyword; <b>| %cl-d-apiname;</b>&quot;&gt;
&lt;!ENTITY % ph      &quot;ph      | %pr-d-ph;&quot;&gt;
&lt;!ENTITY % fig     &quot;fig     | %pr-d-fig;&quot;&gt;
&lt;!ENTITY % dl      &quot;dl      | %pr-d-dl;&quot;&gt;
<b>&lt;!ENTITY % apiname &quot;apiname | %cl-d-apiname;&quot;&gt;</b>

&lt;!--vocabulary attributes--&gt;
&lt;!ATTLIST concept    domains CDATA &quot;&amp;pr-d-att; <b>&amp;cl-d-att;</b>&quot;&gt;
&lt;!ATTLIST reference  domains CDATA &quot;&amp;pr-d-att; <b>&amp;cl-d-att;</b>&quot;&gt;
&lt;!ATTLIST task       domains CDATA &quot;&amp;pr-d-att; <b>&amp;cl-d-att;</b>&quot;&gt;

&lt;!--Redefine the infotype entity to exclude other topic types--&gt;
&lt;!ENTITY % info-types &quot;concept | reference | task&quot;&gt;

&lt;!--Embed topic to get generic elements --&gt;
&lt;!ENTITY % topic-type PUBLIC &quot;-//IBM//ELEMENTS DITA Topic//EN&quot; &quot;topic.mod&quot;&gt;
  %topic-type;

&lt;!--Embed topic types to get specific topic structures--&gt;
&lt;!ENTITY % concept-typemod PUBLIC &quot;-//IBM//ELEMENTS DITA Concept//EN&quot; &quot;concept.mod&quot;&gt;
  %concept-typemod;
&lt;!ENTITY % reference-typemod PUBLIC &quot;-//IBM//ELEMENTS DITA Reference//EN&quot; &quot;reference.mod&quot;&gt;
  %reference-typemod;
&lt;!ENTITY % task-typemod PUBLIC &quot;-//IBM//ELEMENTS DITA Task//EN&quot; &quot;task.mod&quot;&gt;
  %task-typemod;

&lt;!--vocabulary definitions--&gt;
&lt;!ENTITY % pr-d-def PUBLIC &quot;-//IBM//ELEMENTS DITA Programming Domain//EN&quot; &quot;programming-domain.mod&quot;&gt;
  %pr-d-def;
<b>&lt;!ENTITY % cl-d-def SYSTEM &quot;classlib-domain.mod&quot;&gt; %cl-d-def;</b>
</codeblock>
        <p>Notice that the class library phrases are added to the element entity for <apiname>keyword</apiname> as well as for <apiname>apiname</apiname>. This addition makes the class library phrases available within topic structures that allow keywords and not just in topic structures that explicitly allow API names. In fact, the structures of the <apiname>reference</apiname> topic specify only keywords, but it&apos;s good practice to add the domain specialization entities to all ancestor elements.</p>
      </section>
    </body>
  </topic>
  <topic id="consideration">
    <title>Considerations for domain specialization</title>
    <body>
      <p>When you define new types of topics or domain elements, remember that the hierarchies for topic specialization and domain specialization must be distinct. A specialized topic cannot use a domain element in a content model. Similarly, a domain element can specialize only from an element in the base topic or in another domain. That is, a topic and domain cannot have dependencies. To combine topics and domains, use a shell DTD.</p>
      <p>When specializing elements with internal structure including the <apiname>ul</apiname>, <apiname>ol</apiname>, and <apiname>dl</apiname> lists as well as <apiname>table</apiname> and <apiname>simpletable</apiname>, you should specialize the entire content element. Creating special types of pieces of the internal structure independently of the whole content structure usually doesn&apos;t make much sense. For example, you usually want to create a special type of list instead of a special type of <apiname>li</apiname> list item for ordinary <apiname>ul</apiname> and <apiname>ol</apiname> lists.</p>
      <p>You should never specialize from the elements of the highlight domain. These style elements do not have a specific semantic. Although the formatting of the highlight styles might seem convenient, you might find you need to change the formatting later. </p>
      <p>As noted previously, you should use element entities instead of literal element names in content models. The element entities are necessary to permit domain specialization. </p>
      <p>The content model should allow for the possibility that the element entity might expand to a list. When applying a modifier to the element entity, you should enclose the element entity in parentheses. Otherwise, the modifier will apply only to the last element if the entity expands to a list. Similar issues affect an element entity in a sequence:</p>
      <codeblock>..., ( %classname; ), ...
... ( %classname; )? ...

... ( %classname; )* ...
... ( %classname; )+ ...
... | %classname; | ...
</codeblock>
      <p>The parentheses aren&apos;t needed if the element entity is already in a list.</p>
    </body>
  </topic>
  <topic id="generalize">
    <title>Generalizing a domain</title>
    <body>
      <p>As with topics, a specialized content element can be generalized to one of its ancestor elements. In the previous scenario, a <apiname>classname</apiname> can generalize to <apiname>apiname</apiname> or even <apiname>keyword</apiname>. As a result, documents using different domains but the same topics can be exchanged or merged without having to generalize the topics.</p>
      <p>To return to the highlight style controversy mentioned in <xref href="#base" type="topic"/>, a pragmatic document authored with highlight domain will contain phrases like the following:</p>
      <codeblock>... the &lt;b&gt;important&lt;/b&gt; point is ...</codeblock>
      <p>When the document is generalized to the same topic but without the highlight domain, the pragmatic <apiname>b</apiname> element becomes a purist <apiname>ph</apiname> element, indicating that the phrase is special without introducing presentation:</p>
      <codeblock>... the &lt;ph class=&quot;+ topic/ph hi-d/b &quot;&gt;important&lt;/ph&gt; point is ...</codeblock>
      <p>In the previous scenario, the class library authors could send their topics to another DITA shop without the class library domain. The recipients would generalize the class library topics, converting the <apiname>classname</apiname> elements to <apiname>apiname</apiname> base elements. After generalization, the recipients could edit and process the class, field, and method names in the same way as any other API names. That is, the situation would be the same as if the senders had decided not to distinguish class, field, and method names and, instead, had marked up these names as generic API names.</p>
      <p>As an alternative, the recipients could decide to add the class library domain to their definitions. In this approach, the senders would provide not only their topics but also the entity declaration and element definition files for the domain. The recipients would add the class library domain to their shell DTD. The recipients could then work with <apiname>classname</apiname> elements without having to generalize.</p>
      <p>The recipients can use additional domains with no impact on interoperability. That is, the shell DTD for the recipients could use more domains than the shell DTD for the senders without creating any need to modify the topics. </p>
      <note>When defining specializations, you should avoid introducing a dependency on special processing that lacks a graceful fallback to the processing for the base element. In the scenario, special processing for the <apiname>classname</apiname> element might generate a literal <q>class</q> label in the output to save some typing and produce consistent labels. After automated generalization, however, the label would not be supplied by the base processing for the <apiname>apiname</apiname> element. Thus, the dependency would require a special generalization transform to append the literal <q>class</q> label to <apiname>classname</apiname> elements in the source file.</note>
    </body>
  </topic>
  <topic id="summary">
    <title>Summary</title>
    <body>
      <p>Through topic specialization and domains, DITA provides the following benefits:</p>
      <ul>
        <li>
          <p>Simpler topic design.</p>
          <p>The document designer can focus on the structure of the topic without having to foresee every variety of content used within the structure.</p>
        </li>
        <li>
          <p>Simpler topic hierarchies.</p>
          <p>The document designer can add new types of content without having to add new types of topics.</p>
        </li>
        <li>
          <p>Extensible content for existing topics.</p>
          <p>The document designer can reuse existing types of topics with new types of content. </p>
        </li>
        <li>
          <p>Semantic precision.</p>
          <p>Content elements with more specific semantics can be derived from existing elements and used freely within documents. </p>
        </li>
        <li>
          <p>Simpler element lists for authors.</p>
          <p>The document designer can select domains to minimize the element set. Authors can learn the elements that are appropriate for the document instead of learning to disregard unneeded elements. </p>
        </li>
      </ul>
      <p> In short, the DITA domain feature provides for great flexibility in extending and reusing information types. The highlight, programming, and UI domains provided with the base DITA release are only the beginning of what can be accomplished.</p>
      <section>
        <title>Notices</title>
        <lq>
          <p>© Copyright International Business Machines Corp., 2002, 2003. All rights reserved.</p>
          <p>The information provided in this document has not been submitted to any formal IBM test and is distributed &quot;AS IS,&quot; without warranty of any kind, either express or implied. The use of this information or the implementation of any of these techniques described in this document is the reader&apos;s responsibility and depends on the reader&apos;s ability to evaluate and integrate them into their operating environment. Readers attempting to adapt these techniques to their own environments do so at their own risk. </p>
        </lq>
      </section>
    </body>
  </topic>
</topic>

