The primary purpose of defining XHTML modules and a general modularization methodology is to ease the development of document types that are based upon XHTML. These document types may extend XHTML
by integrating additional capabilities (e.g., [SMIL]), or they may define a subset of XHTML for use in a specialized device. This section describes the
techniques that document type designers must use in order to take advantage of the XML DTD implementation of this modularization architecture. It does this by applying the XHTML Modularization
techniques in progressively more complex ways, culminating in the creation of a complete document type from disparate modules.

Note that in no case do these examples require the modification of the XHTML-provided module file entities themselves. The XHTML module file entities are completely parameterized, so that
it is possible through separate module definitions and driver files to customize the definition and the content model of each element and each element's hierarchy.

Finally, remember that most users of XHTML are not expected to be DTD authors. DTD authors are generally people who are defining specialized markup that will improve the readability,
simplify the rendering of a document, or ease machine-processing of documents, or they are client designers that need to define the specialized DTD for their specific client. Consider these
cases:

An organization is providing subscriber's information via a Web interface. The organization stores its subscriber information in an XML-based database. One way to report that information out from
the database to the Web is to embed the XML records from the database directly in the XHTML document. While it is possible to merely embed the records, the organization could define a DTD module that
describes the records, attach that module to an XHTML DTD, and thereby create a complete DTD for the pages. The organization can then access the data within the new elements via the Document Object
Model [DOM], validate the documents, provide style definitions for the elements that cascade using Cascading Style Sheets
[CSS2], etc. By taking the time to define the structure of their data and create a DTD using the processes defined in this section, the organization can realize the full benefits of XML.

An Internet client developer is designing a specialized device. That device will only support a subset of XHTML, and the devices will always access the Internet via a proxy server that validates
content before passing it on to the client (to minimize error handling on the client). In order to ensure that the content is valid, the developer creates a DTD that is a subset of XHTML using the
processes defined in this section. They then use the new DTD in their proxy server and in their devices, and also make the DTD available to content developers so that developers can validate their
content before making it available. By performing a few simple steps, the client developer can use the architecture defined in this document to greatly ease their DTD development cost and
ensure that they are fully supporting the subset of XHTML that they choose to include.

would add the "myattr" attribute, with an optional prefix defined by "%MyModule.pfx", with a value type of CDATA, to the "a" element. This works because XML permits the definition or extension of
the attribute list for an element at any point in a DTD. For a discussion of qualified names and namespace prefixes, see Defining the Namespace
of a Module.

Naturally, adding an attribute to a DTD does not mean that any new behavior is defined for arbitrary clients. However, a content developer could use an extra attribute to store information that is
accessed by associated scripts via the Document Object Model (for example).

Since the content model of XHTML modules is fully parameterized, DTD authors may modify the content model for every element in every module. The details of the DTD module interface are defined in
Building DTD Modules. Basically there are two ways to approach this modification:

Re-define the ".content" parameter entity for each element.

Re-define one or more of the global content model entities (normally via the ".extras" parameter entity).

The strategy taken will depend upon the nature of the modules being combined and the nature of the elements being integrated. The remainder of this section describes techniques for integrating two
different classes of modules.

When a module (and remember, a module can be a collection of other modules) contains elements that only reference each other in their content model, it is said to be "internally complete". As
such, the module can be used on its own; (for example, you could define a DTD that was just that module, and use one of its elements as the root element). Integrating such a module into XHTML is a
three step process:

Decide what element(s) can be thought of as the root(s) of the new module.

Decide where these elements need to attach in the XHTML content tree.

Then, for each attachment point in the content tree, add the root element(s) to the content definition for the XHTML elements.

Consider attaching the elements defined above. In that example, the element myelement is the root. To attach this element under the img element, and
only the img element, of XHTML, the following would work:

<!ENTITY % img.content "( %MyModule.myelement.qname; )*">

A DTD defined with this content model would allow a document like the following fragment:

It is important to note that normally the img element has a content model of EMPTY. By adding myelement to that content model, we are really just replacing
EMPTY with myelement. In the case of other elements that already have content models defined, the addition of an element would require the restating of the existing content model
in addition to myelement.

Extending the example above, to attach this module everywhere that the %Flow.mix content model group is permitted, would require something like the following:

<!ENTITY % Misc.extra
"| %MyModule.myelement.qname;" >

Since the %Misc.extra content model class is used in the %Misc.class parameter entity, and that parameter entity is used throughout the XHTML modules, the new module would become available
throughout an extended XHTML document type.

So far the examples in this section have described the methods of extending XHTML and XHTML's content model. Once this is done, the next step is to collect the modules that comprise the DTD into a
single DTD driver, incorporating the new definitions so that they override and augment the basic XHTML definitions as appropriate.

Next, there is the situation where a complete, additional, and complex module is added to XHTML (or to a subset of XHTML). In essence, this is the same as in the trivial example above, the only
difference being that the module being added is incorporated in the DTD by reference rather than explicitly including the new definitions in the DTD.

One such complex module is the DTD for [MATHML]. In order to combine MathML and XHTML into a single DTD, an author would just decide where MathML content
should be legal in the document, and add the MathML root element to the content model at that point. First, define a content model module that instantiates the MathML DTD and connects it to the
content model:

Another way in which DTD authors may use XHTML modules is to define a DTD that is a subset of an XHTML family document type (because, for example, they are building devices or software that only
supports a subset of XHTML). Doing this is only slightly more complex than the previous example. The basic steps to follow are:

Take an XHTML family DTD as the basis of the new document type (we will use XHTML 1.1).

Select the modules to remove from that DTD.

Define a new DTD that "IGNOREs" the modules.

Introduce some new modules.

For example, consider a device that uses XHTML modules, but without forms or tables. The DTD for such a device would look like this:

Note that this does not actually modify the content model for the XHTML 1.1 DTD. However, since XML ignores elements in content models that are not defined, the form and table elements are dropped
from the model automatically.

Finally, some DTD authors may wish to start from scratch, using the XHTML Modularization framework as a toolkit for building a new markup language. This language must be made up of the minimal,
required modules from XHTML. It may also contain other XHTML-defined modules or any other module that the author wishes to employ. In this example, we will take the XHTML required modules, add some
XHTML-defined modules, and also add in the module we defined above.

The first step is to use the XHTML-provided template for a new qualified names module, modified to define the qualified names and namespace for our
new elements.

Now, build a content model description that hooks the new elements and attributes into the other XHTML elements. The following example is patterned after the XHTML Basic content model, but is a
complete, free-standing content model module: