5. Creating documentation for a new model

5.1. Creating model documentation from scratch
5.2. Creating model documentation using the graphical user interface

Model documentation is structured as a book composed of chapters and appended with all schemas that need to be documented. This section provides a basic walkthrough of the steps necessary to create a new document. If you require a more complete explanation, refer to the DTD documentation (Section 7, “Reference manual : document model”). A sample is provided in the installation directory, in the sample sub directory.

To create documentation for a new model, two approaches are available:

In order to create documentation for a new model, you need to create a skeleton file that conforms to the SchemaDoc DTD. The skeleton contains an article element, which has been modified from the DocBook standard. These are the necessary steps:

  1. Define the document type and entities

    The document type declaration must be associated with the location of the SchemaDoc DTD because the public name is not enough.

    <!DOCTYPE article PUBLIC
    "-//TIREME//DTD Documentation Of Schema Reference//EN" "..\models\dtds\SchemaDoc.dtd"
    [

    All required parameter entities are defined within the document type declaration. This is a requirement for all schema used because the XML Schema specification relies on file organization.

    <!ENTITY mod1 SYSTEM "./myFirstModel.xsd"> <!ENTITY
    mod2 SYSTEM "../models/schemas/anOtherModel.xsd">

    For large volume documentation, it is possible to create fragments. This may be done at the sect1 level. In order to do this, all sections are created in separate files and are included within the documentation as new parameter entities.

  2. Namespaces

    SchemaDoc tools are namespace aware so the article element must declare all required namespaces for SchemaDoc.

    <article 

    	xmlns:sd="http://www.tireme.fr/XMLSchema/documentation/V1/" 

    	xmlns:tbl="http://www.oasis-open.org/tables/exchange/1.0" 

    	xmlns:xs="http://www.w3.org/2001/XMLSchema" 

    	xmlns="http://www.oasis-open.org/docbook/xmlschema/4.1.2"

     ... >

    The required namespaces to be declared are:

    • the SchemaDoc namespace: "http://www.tireme.fr/XMLSchema/documentation/V1/"

    • the XML Schema namespace: "http://www.w3.org/2001/XMLSchema"

    • the DocBook namespace, which is the default namespace: "http://www.oasis-open.org/docbook/xmlschema/4.1.2"

  3. Default namespace for references

    In order to simplify references from the DTD to objects defined within XML Schema, qualified names are used. This is not useful while writing documentation because there is too much information to provide. Therefore, SchemaDoc makes it possible to put at all section levels of documentation (sect1, sect2, etc.) a default namespace for all contained references. This default namespace must be initialized at the level of the article element.

    <article 	... 	sd:defaultNS="http://www.tireme.fr/XMLSchema/documentation/V1/">

  4. Language

    All programs that generate output provide explanation of labels. This information must be in the same language as the documentation itself. A sdLang.attribute attribute defines whether the documentation is in French or English. These are the only languages available at present.

    <article 	... 	sd:language="fr">

  5. Documentation information

    Once the article element has been created, you specify all documentation sections. If required, you can add standard DocBook articleinfo to provide metadata information such as author, version, and titles.

    If sect1 and articleinfo elements have been defined as parameter entities, they are called here.

    &info;

    &docIntro; <!-- first documentation section
    -->

    &tools; <!-- second documentation section -->

    &xs2dtdSpec; <!-- third documentation section
    -->

  6. Schema information

    Following the documentation section, you use a SchemaDoc sd:schemaDef container element to define the schema used in the model.

    <sd:schemaDef>

     ... 

    </sd:schemaDef>

  7. Namespace identification

    As the first element within sd:schemaDef, you declare all namespace prefixes used within the documentation. This is a current limitation of SchemaDoc and is necessary to facilitate reference solving algorithms.

    If different prefixes are used for the same namespace within the documentation, they must all be declared. The default namespace must also be declared.

    <nsDecl 

     nsPrefix="db"

    	nsName="http://www.oasis-open.org/docbook/xmlschema/4.1.2"/>

    <nsDecl 

     nsPrefix="sd"

     nsName="http://www.tireme.fr/XMLSchema/documentation/V1/"/>

    <nsDecl 

     nsPrefix="xs"

     nsName="http://www.w3.org/2001/XMLSchema"/>

  8. Including schemas

    You must reference all schemas used by the documentation as parameter entities.

    <sd:schemaDef>

    	<!-- namespace declarations -->

    	...

    	<!-- schema includes -->

    	&mod1;

    	&mod2;

    </sd:schemaDef>

    For the schema element itself, refer to xs:schema definition in order to understand the different attributes that need to be set up.

  9. That's all!

    All necessary information for the skeleton of documentation is defined.

A graphical user interface is provided to create the skeleton of documentation for a new model. A new set of documentation is generated from information defined in the interface. This documentation can then be extended as needed.


Once the new documentation is created, everything will need to be tuned if there is a need to add other schemas or to add new chapters of documentation (see Section 5.1, “Creating model documentation from scratch”).