Diff between http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/dtd_developing.html and simpleml-model-1.mod

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<title>XHTML Modularization 1.1 - Developing DTDs with defined and extended modules</title>
<link rel="prev" type="text/html" href="dtd_module_rules.html" />
<link rel="next" type="text/html" href="dtd_module_defs.html" />
<link rel="stylesheet" type="text/css" href="xhtml.css" />
<link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-PR.css" />
</head>
<body>
<div class="navbar">[<a href="dtd_module_rules.html">previous</a>] &#160; [<a href="dtd_module_defs.html">next</a>] &#160; [<a href="Overview.html#toc">table of contents</a>] 
<!-- File: simpleml-model-1.mod -->

<hr />
</div>
<!-- Declare a Parameter Entity (PE) that defines any external namespaces 
     that are used by this module -->

<h1><a name="s_developingdtds" id="s_developingdtds">E.</a> Developing DTDs with defined and extended modules</h1>

<div class='subtoc'>
<p><strong>Contents</strong></p>

<ul class='toc'>
<li class='tocline'>E.1. <a href="#s_dev_attrs" class="tocxref">Defining additional attributes</a></li>

<li class='tocline'>E.2. <a href="#s_dev_elems" class="tocxref">Defining additional elements</a></li>

<li class='tocline'>E.3. <a href="#s_dev_contentmodel" class="tocxref">Defining the content model for a collection of modules</a> 

<ul class="toc">
<li class='tocline'>E.3.1. <a href="#sec_E.3.1." class="tocxref">Integrating a stand-alone module into XHTML</a></li>

<li class='tocline'>E.3.2. <a href="#sec_E.3.2." class="tocxref">Mixing a new module throughout the modules in XHTML</a></li>
</ul>
</li>

<li class='tocline'>E.4. <a href="#sec_E.4." class="tocxref">Creating a new DTD</a> 

<ul class="toc">
<li class='tocline'>E.4.1. <a href="#sec_E.4.1." class="tocxref">Creating a simple DTD</a></li>

<li class='tocline'>E.4.2. <a href="#sec_E.4.2." class="tocxref">Creating a DTD by extending XHTML</a></li>

<li class='tocline'>E.4.3. <a href="#sec_E.4.3." class="tocxref">Creating a DTD by removing and replacing XHTML modules</a></li>

<li class='tocline'>E.4.4. <a href="#sec_E.4.4." class="tocxref">Creating a new DTD</a></li>
</ul>
</li>

<li class='tocline'>E.5. <a href="#sec_E.5." class="tocxref">Using the new DTD</a></li>
</ul>
</div>

<p>This section is <b>informative</b>.</p>

<p>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., <a href="references.html#ref_smil">[SMIL]</a>), 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.</p>

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

<p>Finally, remember that most users of XHTML are <em>not</em> 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:</p>

<ul>
<li>
<p>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 <a href="references.html#ref_dom">[DOM]</a>, validate the documents, provide style definitions for the elements that cascade using Cascading Style Sheets <a href="references.html#ref_css2">
[CSS2]</a>, 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.</p>
</li>

<li>
<p>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 <em>and</em>
ensure that they are fully supporting the subset of XHTML that they choose to include.</p>
</li>
</ul>

<h2><a name="s_dev_attrs" id="s_dev_attrs">E.1.</a> Defining additional attributes</h2>

<p>In some cases, an extension to XHTML can be as simple as additional attributes. Attributes can be added to an element just by specifying an additional ATTLIST for the element, for example:</p>

<pre class="example">
&lt;!ATTLIST %a.qname;
      %MyModule.pfx;myattr   CDATA        #IMPLIED
      %MyModule.xmlns.extras.attrib;
&gt;
</pre>

<p>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. <em>For a discussion of qualified names and namespace prefixes, see <a href="dtd_module_rules.html#s_module_namespace">Defining the Namespace
of a Module</a>.</em></p>

<p>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).</p>

<h2><a name="s_dev_elems" id="s_dev_elems">E.2.</a> Defining additional elements</h2>

<p>Defining additional elements is only slightly more complicated than defining additional attributes. Basically, DTD authors should write the element declaration for each element:</p>

<pre class="example">
&lt;!-- In the qname sub-module --&gt;
&lt;!ENTITY % MyModule.myelement.qname  "%MyModule.pfx;myelement" &gt;
&lt;!ENTITY % MyModule.myotherelement.qname  "%MyModule.pfx;myotherelement" &gt;

&lt;!-- In the declaration sub-module --&gt;
&lt;!ELEMENT %MyModule.myelement.qname; 
           ( #PCDATA | %MyModule.myotherelement.qname; )* &gt;
&lt;!ATTLIST %MyModule.myelement.qname;
          myattribute    CDATA    #IMPLIED
&gt;

&lt;!ELEMENT %MyModule.myotherelement.qname; EMPTY &gt;
</pre>

<p>After the elements are defined, they need to be integrated into the content model. Strategies for integrating new elements or sets of elements into the content model are addressed in the next
section.</p>

<h2><a name="s_dev_contentmodel" id="s_dev_contentmodel">E.3.</a> Defining the content model for a collection of modules</h2>

<p>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
<a href="dtd_module_rules.html#s_dtd_module_rules">Building DTD Modules</a>. Basically there are two ways to approach this modification:</p>

<ol>
<li>Re-define the ".content" parameter entity for each element.</li>

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

<p>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.</p>

<h3><a name="sec_E.3.1." id="sec_E.3.1.">E.3.1.</a> Integrating a stand-alone module into XHTML</h3>

<p>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:</p>

<ol>
<li>Decide what element(s) can be thought of as the root(s) of the new module.</li>

<li>Decide where these elements need to attach in the XHTML content tree.</li>

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

<p>Consider attaching the elements defined <a href="#s_dev_elems">above</a>. In that example, the element <tt>myelement</tt> is the root. To attach this element under the <tt>img</tt> element, and
only the <tt>img</tt> element, of XHTML, the following would work:</p>

<pre class="example">
&lt;!ENTITY % img.content "( %MyModule.myelement.qname; )*"&gt;
</pre>

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

<pre class="example">
&lt;img src="..."&gt;
&lt;myml:myelement &gt;This is content of a locally defined element&lt;/myml:myelement&gt;
&lt;/img&gt;
</pre>

<p>It is important to note that normally the <code>img</code> element has a content model of <code>EMPTY</code>. By adding myelement to that content model, we are really just replacing <code>
EMPTY</code> with <code>myelement</code>. 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 <code>myelement</code>.</p>

<h3><a name="sec_E.3.2." id="sec_E.3.2.">E.3.2.</a> Mixing a new module throughout the modules in XHTML</h3>

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

<pre class="example">
&lt;!ENTITY % Misc.extra
     "| %MyModule.myelement.qname;" &gt;
</pre>

<p>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.</p>

<h2><a name="sec_E.4." id="sec_E.4.">E.4.</a> Creating a new DTD</h2>

<p>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.</p>

<h3><a name="sec_E.4.1." id="sec_E.4.1.">E.4.1.</a> Creating a simple DTD</h3>

<p>Using the trivial example above, it is possible to define a new DTD that uses and extends the XHTML modules pretty easily. First, define the new elements and their content model in a module:</p>

<p>You can download this file from <a href="http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/DTD/examples/simpleml-model-1.mod">http://www.w3.org/MarkUp/DTD/examples/simpleml-model-1.mod</a>.</p>

<pre class="dtd">
&lt;!-- File: simpleml-model-1.mod --&gt;

&lt;!-- Declare a Parameter Entity (PE) that defines any external namespaces 
     that are used by this module --&gt;

&lt;!-- Set the PE that is used in every ATTLIST in this module 
<!-- Set the PE that is used in every ATTLIST in this module 
     NS.prefixed.attrib is initialized in the xhtml-qname module, and
     SimpleML.ns.noprefix.attrib is initialized in the SimpleML DTD driver 
     file.--&gt;
&lt;!ENTITY % SimpleML.xmlns.attrib
     file.-->
<!ENTITY % SimpleML.xmlns.attrib
  "%NS.decl.attrib;"
&gt;
>

&lt;!ENTITY % SimpleML.Common.attrib
<!ENTITY % SimpleML.Common.attrib
  "%SimpleML.xmlns.attrib;
   id           ID           #IMPLIED"
&gt;
>

&lt;!ENTITY % SimpleML.element.qname "%SimpleML.pfx;element" &gt;
&lt;!ENTITY % SimpleML.otherelement.qname "%SimpleML.pfx;otherelement" &gt;
<!ENTITY % SimpleML.element.qname "%SimpleML.pfx;element" >
<!ENTITY % SimpleML.otherelement.qname "%SimpleML.pfx;otherelement" >

&lt;!ELEMENT %SimpleML.element.qname;
          ( #PCDATA | %SimpleML.otherelement.qname; )* &gt;
&lt;!ATTLIST %SimpleML.element.qname;
<!ELEMENT %SimpleML.element.qname;
          ( #PCDATA | %SimpleML.otherelement.qname; )* >
<!ATTLIST %SimpleML.element.qname;
          myattribute   CDATA  #IMPLIED
          %SimpleML.Common.attrib;
&gt;
&lt;!ELEMENT %SimpleML.otherelement.qname; EMPTY &gt;
&lt;!ATTLIST %SimpleML.otherelement.qname;
>
<!ELEMENT %SimpleML.otherelement.qname; EMPTY >
<!ATTLIST %SimpleML.otherelement.qname;
          %SimpleML.Common.attrib;
&gt;
>

&lt;!ENTITY % SimpleML.img.myattr.qname "%SimpleML.pfx;myattr" &gt;
&lt;!ATTLIST %img.qname;
<!ENTITY % SimpleML.img.myattr.qname "%SimpleML.pfx;myattr" >
<!ATTLIST %img.qname;
          %SimpleML.img.myattr.qname;  CDATA  #IMPLIED
&gt;
>

&lt;!-- Add our elements to the XHTML content model --&gt;
&lt;!ENTITY % Misc.class
     "| %SimpleML.element.qname;" &gt;
<!-- Add our elements to the XHTML content model -->
<!ENTITY % Misc.class
     "| %SimpleML.element.qname;" >

&lt;!-- Now bring in the XHTML Basic content model --&gt;
&lt;!ENTITY % xhtml-basic-model.mod
<!-- Now bring in the XHTML Basic content model -->
<!ENTITY % xhtml-basic-model.mod
     PUBLIC "-//W3C//ENTITIES XHTML Basic 1.0 Document Model 1.0//EN"
            "http://www.w3.org/TR/xhtml-basic/xhtml-basic10-model-1.mod" &gt;
            "http://www.w3.org/TR/xhtml-basic/xhtml-basic10-model-1.mod" >
%xhtml-basic-model.mod;

</pre>

<p>Next, define the DTD driver for the new language:</p>

<p>You can download this file from <a href="http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/DTD/examples/simpleml-1_0.dtd">http://www.w3.org/MarkUp/DTD/examples/simpleml-1_0.dtd</a>.</p>

<pre class="dtd">
&lt;!-- file: simpleml-1_0.dtd --&gt;

&lt;!-- Bring in the XHTML datatypes --&gt;
&lt;!ENTITY % xhtml-datatypes.mod
     PUBLIC "-//W3C//ENTITIES XHTML Datatypes 1.0//EN"
            "http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/DTD/xhtml-datatypes-1.mod" &gt;
%xhtml-datatypes.mod;

&lt;!-- Declare the actual namespace of this module --&gt;
&lt;!ENTITY % SimpleML.xmlns "http://www.example.com/xmlns/simpleml1" &gt;

&lt;!-- By default, disable prefixing of new module --&gt;
&lt;!ENTITY % NS.prefixed "IGNORE" &gt;
&lt;!ENTITY % SimpleML.prefixed "%NS.prefixed;" &gt; 

&lt;!-- Default prefix for module elements and attributes --&gt;
&lt;!ENTITY % SimpleML.prefix "simpleml" &gt;

&lt;!-- If this module's namespace is prefixed --&gt;
&lt;![%SimpleML.prefixed;[
  &lt;!ENTITY % SimpleML.pfx  "%SimpleML.prefix;:" &gt;
]]&gt;
&lt;!ENTITY % SimpleML.pfx  "" &gt;

&lt;![%SimpleML.prefixed;[
  &lt;!ENTITY % SimpleML.xmlns.extra.attrib 
       "xmlns:%SimpleML.prefix; %URI.datatype; #FIXED '%SimpleML.xmlns;'" &gt;
]]&gt;
&lt;!ENTITY % SimpleML.xmlns.extra.attrib "" &gt;

&lt;!ENTITY % XHTML.xmlns.extra.attrib
       "%SimpleML.xmlns.extra.attrib;"
&gt;
&lt;!-- Set the content model for our language --&gt;
&lt;!ENTITY % xhtml-model.mod
     SYSTEM "simpleml-model-1.mod" &gt;
&lt;!-- Instantiate xhtml basic's DTD to do all the work --&gt;
&lt;!ENTITY % xhtml-basic.dtd
     PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" 
            "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd" &gt;
%xhtml-basic.dtd;

</pre>

<p>When using this DTD, it is possible to enable the use of XML namespace prefixes. When so doing, the start of a document using this new DTD might look like:</p>

<p>You can download this file from <a href="http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/DTD/examples/simple-prefixed.html">http://www.w3.org/MarkUp/DTD/examples/simple-prefixed.html</a>.</p>

<pre class="dtd">
&lt;!DOCTYPE html SYSTEM "simpleml-1_0.dtd" [
  &lt;!ENTITY % SimpleML.prefixed "INCLUDE"&gt;
]&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:simpleml="http://www.example.com/xmlns/simpleml1" &gt;
&lt;head&gt;
&lt;title&gt;An example using defaults&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p&gt;This is content in the XHTML namespace&lt;/p&gt;
&lt;simpleml:element&gt;
  This is content in the SimpleML namespace.
  &lt;simpleml:otherelement /&gt;
&lt;/simpleml:element&gt;
&lt;p&gt;&lt;img src="missing" alt="Missing image" simpleml:myattr="value"/&gt;&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;

</pre>

<h3><a name="sec_E.4.2." id="sec_E.4.2.">E.4.2.</a> Creating a DTD by extending XHTML</h3>

<p>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.</p>

<p>One such complex module is the DTD for <a href="references.html#ref_mathml">[MATHML]</a>. 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:</p>

<pre class="example">
&lt;!-- File: mathml-model.mod --&gt;
&lt;!ENTITY % XHTML1-math
     PUBLIC "-//W3C//DTD MathML 2.0//EN"
            "http://www.w3.org/TR/MathML2/dtd/mathml2.dtd" &gt;
%XHTML1-math;

&lt;!ENTITY % Inlspecial.extra 
     "%a.qname; | %img.qname; | %object.qname; | %map.qname; 
      | %Mathml.Math.qname;" &gt;
</pre>

<p>Next, define a DTD driver that identifies our new content model module as the content model for the DTD, and hands off processing to the XHTML 1.1 driver (for example):</p>

<pre class="example">
&lt;!-- File: xhtml-mathml.dtd --&gt;
&lt;!ENTITY % xhtml-model.mod
      SYSTEM "mathml-model.mod" &gt;
&lt;!ENTITY % xhtml11.dtd
     PUBLIC "-//W3C//DTD XHTML 1.1//EN"
            "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" &gt;
%xhtml11.dtd;
</pre>

<h3><a name="sec_E.4.3." id="sec_E.4.3.">E.4.3.</a> Creating a DTD by removing and replacing XHTML modules</h3>

<p>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:</p>

<ol>
<li>Take an XHTML family DTD as the basis of the new document type (we will use XHTML 1.1).</li>

<li>Select the modules to remove from that DTD.</li>

<li>Define a new DTD that "IGNOREs" the modules.</li>

<li>Introduce some new modules.</li>
</ol>

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

<pre class="example">
&lt;!-- File: xhtml-simple.dtd --&gt;
&lt;!ENTITY % xhtml-form.module "IGNORE" &gt;
&lt;!ENTITY % xhtml-table.module "IGNORE" &gt;
&lt;!ENTITY % xhtml-table.module "IGNORE" &gt;
&lt;!-- Bring in the basic tables module --&gt;
&lt;!ENTITY % xhtml-basic-table.mod
     PUBLIC "-//W3C//ELEMENTS XHTML Basic Tables 1.0//EN"
       "http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/DTD/xhtml-basic-table-1.mod"
&gt;
%xhtml-basic-table.mod;
&lt;!ENTITY % xhtml11.mod
     PUBLIC "-//W3C//DTD XHTML 1.1//EN"
            "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" &gt;
%xhtml11.mod;
</pre>

<p>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.</p>

<h3><a name="sec_E.4.4." id="sec_E.4.4.">E.4.4.</a> Creating a new DTD</h3>

<p>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.</p>

<p>The first step is to use the XHTML-provided <a href="DTD/templates/template-qname-1.mod">template</a> for a new qualified names module, modified to define the qualified names and namespace for our
new elements.</p>

<p>You can download this file from <a href="http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/DTD/examples/myml-qname-1.mod">http://www.w3.org/MarkUp/DTD/examples/myml-qname-1.mod</a>.</p>

<pre class="dtd">
&lt;!-- file: myml-qname-1.mod --&gt;

&lt;!-- Bring in the datatypes - we use the URI.datatype PE for declaring the
     xmlns attributes. --&gt;
&lt;!ENTITY % MyML-datatypes.mod
         PUBLIC "-//W3C//ENTITIES XHTML Datatypes 1.0//EN"
         "http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/DTD/xhtml-datatypes-1.mod" &gt;
%MyML-datatypes.mod;

&lt;!-- By default, disable prefixing of this module --&gt;
&lt;!ENTITY % NS.prefixed "IGNORE" &gt;
&lt;!ENTITY % MyML.prefixed "%NS.prefixed;" &gt;

&lt;!-- Declare the actual namespace of this module --&gt;
&lt;!ENTITY % MyML.xmlns "http://www.example.com/xmlns/myml" &gt;

&lt;!-- Declare the default prefix for this module --&gt;
&lt;!ENTITY % MyML.prefix "myml" &gt;

&lt;!-- If this module's namespace is prefixed --&gt;
&lt;![%MyML.prefixed;[
  &lt;!ENTITY % MyML.pfx  "%MyML.prefix;:" &gt;
]]&gt;
&lt;!ENTITY % MyML.pfx  "" &gt;

&lt;!-- This entity is ALWAYS prefixed, for use when adding our
     attributes to an element in another namespace --&gt;
&lt;!ENTITY % MyML.xmlns.attrib.prefixed
   "xmlns:%MyML.prefix;  %URI.datatype;  #FIXED '%MyML.xmlns;'"
&gt;

&lt;!-- Declare a Parameter Entity (PE) that defines any external namespaces 
     that are used by this module --&gt;
&lt;!ENTITY % MyML.xmlns.extra.attrib "" &gt;

&lt;!-- If we want to use xhtml namespace attributes on our elements, then
     we need a prefix for them; default to xhtml. --&gt;
&lt;!ENTITY % XHTML.prefix "xhtml" &gt;

&lt;!-- Declare a PE that defines the xmlns attributes for use by MyML. --&gt;
&lt;![%MyML.prefixed;[
&lt;!ENTITY % MyML.xmlns.attrib
   "%MyML.xmlns.attrib.prefixed;
    %MyML.xmlns.extra.attrib;"
&gt;
&lt;!-- Make sure that the MyML namespace attributes are included on the XHTML
     attribute set --&gt;
&lt;!ENTITY % XHTML.xmlns.extra.attrib
    "xmlns:%XHTML.prefix;  %URI.datatype;  #FIXED 'http://www.w3.org/1999/xhtml'
    %MyML.xmlns.attrib;" &gt;
]]&gt;
&lt;!-- if we are not prefixed, then our elements should have the default
     namespace AND the prefixed namespace is added to the XHTML set
     because our attributes can be referenced on those elements
--&gt;
&lt;!ENTITY % MyML.xmlns.attrib
   "xmlns   %URI.datatype;  #FIXED '%MyML.xmlns;'
    %MyML.xmlns.extra.attrib;"
&gt;
&lt;!ENTITY % XHTML.xmlns.extra.attrib
   "xmlns:%XHTML.prefix;  %URI.datatype;  #FIXED 'http://www.w3.org/1999/xhtml'
    %MyML.xmlns.attrib.prefixed;"
&gt;
&lt;!-- Now declare the element names --&gt;

&lt;!ENTITY % MyML.myelement.qname "%MyML.pfx;myelement" &gt;
&lt;!ENTITY % MyML.myotherelement.qname "%MyML.pfx;myotherelement" &gt;

</pre>

<p>Next, define a module that defines the elements and attributes using the XHTML provided <a href="DTD/templates/template-1.mod">template</a>.</p>

<p>You can download this file from <a href="http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/DTD/examples/myml-elements-1.mod">http://www.w3.org/MarkUp/DTD/examples/myml-elements-1.mod</a>.</p>

<pre class="dtd">
&lt;!-- ...................................................................... --&gt;
&lt;!-- My Elements Module ................................................... --&gt;
&lt;!-- file: myml-elements-1_0.mod

     PUBLIC "-//MY COMPANY//ELEMENTS XHTML MyML Elements 1.0//EN"
     SYSTEM "http://example.com/DTDs/myml-elements-1_0.mod"

     xmlns:myml="http://example.com/DTDs/myml-1_0.dtd"
     ...................................................................... --&gt;

&lt;!-- My Elements Module

     myelement
     myotherelement

     This module has no purpose other than to provide structure for some
     PCDATA content.
--&gt;

&lt;!ELEMENT %MyML.myelement.qname;
     ( #PCDATA | %MyML.myotherelement.qname; )* &gt;
&lt;!ATTLIST %MyML.myelement.qname;
     myattribute    CDATA   #IMPLIED
     %MyML.xmlns.attrib;
     %XHTML.global.common.attrib;
&gt;

&lt;!ELEMENT %MyML.myotherelement.qname; EMPTY &gt;
&lt;!ATTLIST %MyML.myotherelement.qname;
     %MyML.xmlns.attrib;
     %XHTML.global.common.attrib;
&gt;

&lt;!ENTITY % MyML.img.myattr.qname "%MyML.prefix;:myattr" &gt;
&lt;!ATTLIST %img.qname;
      %MyML.img.myattr.qname;   CDATA  #IMPLIED
      %MyML.xmlns.attrib.prefixed;
&gt;

&lt;!-- end of myml-elements-1_0.mod --&gt;

</pre>

<p>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:</p>

<p>You can download this file from <a href="http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/DTD/examples/myml-model-1.mod">http://www.w3.org/MarkUp/DTD/examples/myml-model-1.mod</a>.</p>

<pre class="dtd">
&lt;!-- ...................................................................... --&gt;
&lt;!-- MyML Model Module  ................................................... --&gt;
&lt;!-- file: myml-model-1.mod

     PUBLIC "-//MY COMPANY//ELEMENTS XHTML MyML Model 1.0//EN"
     SYSTEM "http://example.com/DTDs/myml-model-1_0.mod"

     xmlns:myml="http://www.example.com/xmlns/myml"
     ...................................................................... --&gt;

&lt;!-- Define the content model for Misc.extra --&gt;
&lt;!ENTITY % Misc.class
     "| %MyML.myelement.qname; "&gt;

&lt;!-- ....................  Inline Elements  ...................... --&gt;

&lt;!ENTITY % HeadOpts.mix  
     "( %meta.qname; )*" &gt;

&lt;!ENTITY % I18n.class "" &gt;

&lt;!ENTITY % InlStruct.class "%br.qname; | %span.qname;" &gt;

&lt;!ENTITY % InlPhras.class
     "| %em.qname; | %strong.qname; | %dfn.qname; | %code.qname; 
      | %samp.qname; | %kbd.qname; | %var.qname; | %cite.qname; 
      | %abbr.qname; | %acronym.qname; | %q.qname;" &gt;

&lt;!ENTITY % InlPres.class
     "" &gt;

&lt;!ENTITY % Anchor.class "| %a.qname;" &gt;

&lt;!ENTITY % InlSpecial.class "| %img.qname; " &gt;

&lt;!ENTITY % Inline.extra "" &gt;

&lt;!-- %Inline.class; includes all inline elements,
     used as a component in mixes
--&gt;
&lt;!ENTITY % Inline.class
     "%InlStruct.class;
      %InlPhras.class;
      %InlPres.class;
      %Anchor.class;
      %InlSpecial.class;"
&gt;

&lt;!-- %InlNoAnchor.class; includes all non-anchor inlines,
     used as a component in mixes
--&gt;
&lt;!ENTITY % InlNoAnchor.class
     "%InlStruct.class;
      %InlPhras.class;
      %InlPres.class;
      %InlSpecial.class;"
&gt;

&lt;!-- %InlNoAnchor.mix; includes all non-anchor inlines
--&gt;
&lt;!ENTITY % InlNoAnchor.mix
     "%InlNoAnchor.class;
      %Misc.class;"
&gt;

&lt;!-- %Inline.mix; includes all inline elements, including %Misc.class;
--&gt;
&lt;!ENTITY % Inline.mix
     "%Inline.class;
      %Misc.class;"
&gt;

&lt;!-- .....................  Block Elements  ...................... --&gt;

&lt;!ENTITY % Heading.class 
     "%h1.qname; | %h2.qname; | %h3.qname; 
      | %h4.qname; | %h5.qname; | %h6.qname;" &gt;

&lt;!ENTITY % List.class "%ul.qname; | %ol.qname; | %dl.qname;" &gt;

&lt;!ENTITY % BlkStruct.class "%p.qname; | %div.qname;" &gt;

&lt;!ENTITY % BlkPhras.class 
     "| %pre.qname; | %blockquote.qname; | %address.qname;" &gt;

&lt;!ENTITY % BlkPres.class "" &gt;

&lt;!ENTITY % Block.extra "" &gt;

&lt;!-- %Block.class; includes all block elements,
     used as an component in mixes
--&gt;
&lt;!ENTITY % Block.class
     "%BlkStruct.class;
      %BlkPhras.class;
      %BlkPres.class;
      %Block.extra;"
&gt;

&lt;!-- %Block.mix; includes all block elements plus %Misc.class;
--&gt;
&lt;!ENTITY % Block.mix
     "%Heading.class;
      | %List.class;
      | %Block.class;
      %Misc.class;"
&gt;

&lt;!-- ................  All Content Elements  .................. --&gt;

&lt;!-- %Flow.mix; includes all text content, block and inline
--&gt;
&lt;!ENTITY % Flow.mix
     "%Heading.class;
      | %List.class;
      | %Block.class;
      | %Inline.class;
      %Misc.class;"
&gt;

&lt;!-- special content model for pre element --&gt;
&lt;!ENTITY % pre.content
    "( #PCDATA
     | %Inline.class; )*"
&gt;

&lt;!-- end of myml-model-1.mod --&gt;

</pre>

<p>Finally, use the XHTML-provided <a href="DTD/templates/template.dtd">template</a> for a new DTD, modified as appropriate for our new markup language:</p>

<p>You can download this file from <a href="http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/DTD/examples/myml-1_0.dtd">http://www.w3.org/MarkUp/DTD/examples/myml-1_0.dtd</a>.</p>

<pre class="dtd">
&lt;!-- ....................................................................... --&gt;
&lt;!-- MYML DTD  ............................................................. --&gt;
&lt;!-- file: myml-1_0.dtd --&gt;

&lt;!-- This is the DTD driver for myml 1.0.

     Please use this formal public identifier to identify it:

         "-//MY COMPANY//DTD XHTML MYML 1.0//EN"

     And this namespace for myml-unique elements:

         xmlns:myml="http://www.example.com/xmlns/myml"
--&gt;
&lt;!ENTITY % XHTML.version  "-//MY COMPANY//DTD XHTML MYML 1.0//EN" &gt;

&lt;!-- reserved for use with document profiles --&gt;
&lt;!ENTITY % XHTML.profile  "" &gt;

&lt;!-- Tell the framework to use our qualified names module as an extra qname
driver --&gt;
&lt;!ENTITY % xhtml-qname-extra.mod
     SYSTEM "myml-qname-1.mod" &gt;

&lt;!-- Define the Content Model for the framework to use --&gt;
&lt;!ENTITY % xhtml-model.mod
     SYSTEM "myml-model-1.mod" &gt;

&lt;!-- Disable bidirectional text support --&gt;
&lt;!ENTITY % XHTML.bidi  "IGNORE" &gt;

&lt;!-- Bring in the XHTML Framework --&gt;
&lt;!ENTITY % xhtml-framework.mod
     PUBLIC "-//W3C//ENTITIES XHTML Modular Framework 1.0//EN"
            "http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/DTD/xhtml-framework-1.mod" &gt;
%xhtml-framework.mod;

&lt;!-- Basic Text Module (Required)  ............................... --&gt;
&lt;!ENTITY % xhtml-text.mod
     PUBLIC "-//W3C//ELEMENTS XHTML Basic Text 1.0//EN"
            "http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/DTD/xhtml-text-1.mod" &gt;
%xhtml-text.mod;

&lt;!-- Hypertext Module (required) ................................. --&gt;
&lt;!ENTITY % xhtml-hypertext.mod
     PUBLIC "-//W3C//ELEMENTS XHTML Hypertext 1.0//EN"
            "http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/DTD/xhtml-hypertext-1.mod" &gt;
%xhtml-hypertext.mod;

&lt;!-- Lists Module (required)  .................................... --&gt;
&lt;!ENTITY % xhtml-list.mod
     PUBLIC "-//W3C//ELEMENTS XHTML Lists 1.0//EN"
            "http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/DTD/xhtml-list-1.mod" &gt;
%xhtml-list.mod;

&lt;!-- My Elements Module   ........................................ --&gt;
&lt;!ENTITY % MyML-elements.mod
     SYSTEM "myml-elements-1.mod" &gt;
%MyML-elements.mod;

&lt;!-- XHTML Images module  ........................................ --&gt;
&lt;!ENTITY % xhtml-image.mod
     PUBLIC "-//W3C//ELEMENTS XHTML Images 1.0//EN"
            "http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/DTD/xhtml-image-1.mod" &gt;
%xhtml-image.mod;

&lt;!-- Document Metainformation Module  ............................ --&gt;
&lt;!ENTITY % xhtml-meta.mod
     PUBLIC "-//W3C//ELEMENTS XHTML Metainformation 1.0//EN"
            "http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/DTD/xhtml-meta-1.mod" &gt;
%xhtml-meta.mod;

&lt;!-- Document Structure Module (required)  ....................... --&gt;
&lt;!ENTITY % xhtml-struct.mod
     PUBLIC "-//W3C//ELEMENTS XHTML Document Structure 1.0//EN"
            "http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/DTD/xhtml-struct-1.mod" &gt;
%xhtml-struct.mod;

</pre>

<h2><a name="sec_E.5." id="sec_E.5.">E.5.</a> Using the new DTD</h2>

<p>Once a new DTD has been developed, it can be used in any document. Using the DTD is as simple as just referencing it in the DOCTYPE declaration of a document:</p>

<p>You can download this file from <a href="http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/DTD/examples/myml-noprefix.xhtml">http://www.w3.org/MarkUp/DTD/examples/myml-noprefix.xhtml</a>.</p>

<pre class="dtd">
&lt;!DOCTYPE html SYSTEM "myml-1_0.dtd" &gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:xhtml="http://www.w3.org/1999/xhtml" 
      xmlns:myml="http://www.example.com/xmlns/myml" &gt;
&lt;head&gt;
&lt;title&gt;An example using defaults&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p&gt;This is content in the XHTML namespace&lt;/p&gt;
&lt;myelement xhtml:id="myid" xhtml:class="localElement"&gt;
  This is content in the SimpleML namespace.
  &lt;myotherelement /&gt;
&lt;/myelement&gt;
&lt;p&gt;&lt;img src="missing" alt="Missing image" myml:myattr="value"/&gt;&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;

</pre>

<p>The document can also use the elements outside of the XHTML namespace by prefixing them:</p>

<p>You can download this file from <a href="http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/DTD/examples/myml-prefixed.xhtml">http://www.w3.org/MarkUp/DTD/examples/myml-prefixed.xhtml</a>.</p>

<pre class="dtd">
&lt;!DOCTYPE html SYSTEM "myml-1_0.dtd" [
  &lt;!ENTITY % MyML.prefixed "INCLUDE" &gt;
]&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:xhtml="http://www.w3.org/1999/xhtml" 
      xmlns:myml="http://www.example.com/xmlns/myml" &gt;
&lt;head&gt;
&lt;title&gt;An example using defaults&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p&gt;This is content in the XHTML namespace&lt;/p&gt;
&lt;myml:myelement xhtml:id="myid" xhtml:class="localElement"&gt;
  This is content in the myml namespace.
  &lt;myml:myotherelement /&gt;
&lt;/myml:myelement&gt;
&lt;p&gt;&lt;img src="missing" alt="Missing image" myml:myattr="value" /&gt;&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;

</pre>

<hr />
<div class="navbar">[<a href="dtd_module_rules.html">previous</a>] &#160; [<a href="dtd_module_defs.html">next</a>] &#160; [<a href="Overview.html#toc">table of contents</a>]</div>
</body>
</html>

      
Properties
http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/dtd_developing.html simpleml-model-1.mod
base_uri@:http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/dtd_developing.html
charset@:utf-8
content_type@:text/html
last_modified@:2008-06-11 17:44:44Z
uri@:http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/dtd_developing.html<>2008-06-13 08:00:48Z
uri@:http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/dtd_developing.html<>2008-06-13 08:01:47Z
uri@:http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/dtd_developing.html<>2008-06-13 08:02:16Z
uri@:http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/dtd_developing.html<>2008-06-13 08:02:47Z
uri@:http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/dtd_developing.html<>2008-06-13 08:03:27Z
uri@:http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/dtd_developing.html<>2008-06-13 08:04:06Z
uri@:http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/dtd_developing.html<>2008-06-13 08:04:31Z
uri@:http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/dtd_developing.html<>2008-06-13 08:04:57Z
uri@:http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/dtd_developing.html<>2008-06-13 08:05:18Z
uri@:http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/dtd_developing.html<>2008-06-13 08:05:47Z
documentation@:uri:http://www.y-adagio.com/public/standards/tr_xhtml_mod/dtd_developing.html
documentation@:uri@:http://www.w3.org/MarkUp/2007/ED-xhtml-modularization-20071002/dtd_developing.html
documentation@:uri:http://www.w3.org/MarkUp/2007/ED-xhtml-modularization-20071115/dtd_developing.html
documentation@:uri:http://www.w3.org/MarkUp/2008/ED-xhtml-modularization-20080116/dtd_developing.html
documentation@:uri:http://www.w3.org/MarkUp/2008/ED-xhtml-modularization-20080319/dtd_developing.html
documentation@:uri:http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611/dtd_developing.html
documentation@:uri:http://www.w3.org/MarkUp/2008/ED-xhtml-modularization-20080813/dtd_developing.html
documentation@:uri:http://www.w3.org/TR/2008/REC-xhtml-modularization-20081008/dtd_developing.html
documentation@:uri:http://www.w3.org/MarkUp/2009/ED-xhtml-modularization-20091007/dtd_developing.html
file_name@en:simpleml-model-1.mod
ref@:public_id@en:-//W3C//ENTITIES XHTML Basic 1.0 Document Model 1.0//EN;system_id@en:http://www.w3.org/TR/xhtml-basic/xhtml-basic10-model-1.mod
src@:digest:71c594f8e7b109619b920112ea21223d
src@:digest:80cf521fcf98844188522f6f450ecb57
src@:digest:908b8223da3a562fe1e2f6bfecba6eea
src@:digest:6d4e29a2390fb26048e5326fd52f9496
src@:digest:1d6a736c39c2661164ed9737333cdc04
src@:digest:a618778d42663d9abae9ce82972ea6ca
tag@en:DTD Module
tag@en:HTML
tag@en:HTML Activity
tag@en:HTML WG (XHTML1)
tag@en:JIS
tag@en:W3C
tag@en:XHTML
tag@en:XHTML m12n
tag@en:XHTML m12n 1.0
tag@en:XHTML1
tag@en:XHTML2 WG
tag@en:XML DTD
Edit Edit