<Quick>  <JXML>  <Download>  <QJML>

 

QDML Schema

A QDML schema describes the various elements and attributes of an XML markup language.

Each QDML element is described as follows:

The following color scheme is used:

QDML has 8 elements:

 

 
ELEMENT: qdml
DTD: <!ELEMENT qdml (element+)> <!ATTLIST qdml root CDATA #IMPLIED> QDML: <element name="qdml"> <attribute name="root"/> <child element="element" repeating="True"/> </element>

 

The qdml element is the root element of every QDML schema. It serves the purpose of providing the single root element that is required of a well-formed XML document, as well as identifying the document as a QDML schema.

 

Sample XML

<timesheet name="Bill la Forge">
    <day date="19990913">
        <entry hours="8" project="quite"/>
    </day>
    <day date="19990914">
        <entry hours="6" project="quite"/>
        <entry hours="2" project="admin"/>
    </day>
    <day date="19990915">
        <entry hours="8" project="quite"/>
    </day>
    <day date="19990916">
        <entry hours="8" project="vacation"/>
    </day>
    <day date="19990917">
        <entry hours="8" project="quite"/>
    </day>
</timesheet>

QDML

<qdml root="timesheet">
.
. <!--timesheet elements-->
.
</qdml>

This is an example of a fragment of a QDML schema. In this example, we are defining a markup language, timesheet, which has a root element of timesheet.

 

Attributes

A qdml element has an optional attribute, root. This attribute identifies the outermost element of the markup language being defined by the QDML schema.

 

Content Model

Every qdml element must contain one or more element elements. These subordinate elements specify the various elements that comprise the markup language being defined by the QDML schema.

 

 
ELEMENT: element
DTD: <!ELEMENT element (rem*, attribute*, (child|selection|sequence)*)> <!ATTLIST element name CDATA #REQUIRED wild CDATA "False" content (PCDATA,BIMODAL,EMPTY)> QDML: <element name="element"> <attribute name="name" status="REQUIRED"/> <attribute name="wild" value="False"/> <attribute name="content"> <value>PCDATA</value> <value>BIMODAL</value> <value>EMPTY</value> </attribute> <child element="rem" optional="True" repeating="True"/> <child element="attribute" optional="True" repeating="True"/> <selection optional="True" repeating="True"> <child element="child"/> <child element="selection"/> <child element="sequence"/> </selection> </element>

 

The element element is used to specify an element within the markup language being defined by the QDML schema.

 

Sample XML

<timesheet name="Bill la Forge">
    <day date="19990913">
        <entry hours="8" project="quite"/>
    </day>
    <day date="19990914">
        <entry hours="6" project="quite"/>
        <entry hours="2" project="admin"/>
    </day>
    <day date="19990915">
        <entry hours="8" project="quite"/>
    </day>
    <day date="19990916">
        <entry hours="8" project="vacation"/>
    </day>
    <day date="19990917">
        <entry hours="8" project="quite"/>
    </day>
</timesheet>

QDML

<qdml root="timesheet">

    <element name="timesheet">
    .
    . <!--attribute, child, selection, and sequence elements-->
    .
    </element">

    <element name="day">
    .
    . <!--attribute, child, selection, and sequence elements-->
    .
    </element">

    <element name="entry" content="EMPTY">
    .
    . <!--attribute elements-->
    .
    </element">

</qdml>

In this fragment of the QDML schema for the timesheet markup language, we have now specified that the markup language has three elements: timesheet, day, and entry.

The assignment of EMPTY to the content attribute on the specification of the entry element indicates that this element will contain neither text nor elements.

 

Attributes

An element element has the following attributes:

 

Content Model

An element element contains the following elements:

 

 
ELEMENT: attribute
DTD: <!ELEMENT attribute (rem*,value*)> <!ATTLIST attribute name CDATA #REQUIRED type (id,idref) #IMPLIED status (REQUIRED,FIXED) #IMPLIED value CDATA #IMPLIED> QDML: <element name="attribute"> <attribute name="name" status="REQUIRED"/> <attribute name="type" field="type"> <value>id</value> <value>idref</value> </attribute> <attribute name="status"> <value>REQUIRED</value> <value>FIXED</value> </attribute> <attribute name="value"/> <child element="rem" optional="True" repeating="True"/> <child element="value" optional="True" repeating="True"/> </element>

 

The attribute element is used to specify the attributes of an element.

 

Sample XML

<timesheet name="Bill la Forge">
    <day date="19990913">
        <entry hours="8" project="quite"/>
    </day>
    <day date="19990914">
        <entry hours="6" project="quite"/>
        <entry hours="2" project="admin"/>
    </day>
    <day date="19990915">
        <entry hours="8" project="quite"/>
    </day>
    <day date="19990916">
        <entry hours="8" project="vacation"/>
    </day>
    <day date="19990917">
        <entry hours="8" project="quite"/>
    </day>
</timesheet>

QDML

<qdml root="timesheet">

    <element name="timesheet">
        <attribute name="name" status="REQUIRED"/>
    .
    . <!--child, selection, and sequence elements-->
    .
    </element">

    <element name="day">
        <attribute name="date" status="REQUIRED"/>
    .
    . <!--child, selection, and sequence elements-->
    .
    </element">

    <element name="entry"
             content="EMPTY">
        <attribute name="hours" status="REQUIRED"/>
        <attribute name="project" status="REQUIRED"/>
    </element">

</qdml>

This QDML fragment specifies the attributes used in the timesheet markup language:

 

Attributes

An attribute element has the following attributes:

 

Content Model

An attribute element may contain rem and value elements. The rem elements are comments which describe the attribute. The value elements enumerate the legal values that may be assigned to the attribute being defined.

Both rem and value elements are optional, and there may be more than one.

 

 
ELEMENT: rem
DTD: <!ELEMENT rem (#PCDATA)> QDML: <element name="rem" content="PCDATA"/>

 

The rem element is used to describe an element or attribute.

 

Sample QDML

<attribute name="color">
    <rem>The only colors supporte are blue and yellow</rem>
</attribute>

In this QDML fragment, the color attribute is specified as optional (not REQUIRED), with only three acceptable values: red, blue, and yellow.

 

Attributes: none

 

Content Model

A rem element contains a single line of text. It contains no elements.

 

 
ELEMENT: value
DTD: <!ELEMENT value (#PCDATA)> QDML: <element name="value" content="PCDATA"/>

 

The value element enumerates through the legal values of an attribute.

 

Sample XML

<ball color="red"/>

QDML

<attribute name="color">
    <value>red</value>
    <value>blue</value>
    <value>yellow</value>
</attribute>

In this QDML fragment, the color attribute is specified as optional (not REQUIRED), with only three acceptable values: red, blue, and yellow.

 

Attributes: none

 

Content Model

A value element contains text. It contains no elements.

 

 
ELEMENT: child
DTD: <!ELEMENT child EMPTY> <!ATTLIST child element CDATA #REQUIRED optional CDATA "False" repeating CDATA "False"> QDML: <element name="child" content="EMPTY";> <attribute name="element" status="REQUIRED"/> <attribute name="optional" value="False"/> <attribute name="repeating" value="False"/> </element>

 

A child element is used to specify an element that is contained within the content model of another element.

 

Sample XML

<timesheet name="Bill la Forge">
    <day date="19990913">
        <entry hours="8" project="quite"/>
    </day>
    <day date="19990914">
        <entry hours="6" project="quite"/>
        <entry hours="2" project="admin"/>
    </day>
    <day date="19990915">
        <entry hours="8" project="quite"/>
    </day>
    <day date="19990916">
        <entry hours="8" project="vacation"/>
    </day>
    <day date="19990917">
        <entry hours="8" project="quite"/>
    </day>
</timesheet>

QDML

<qdml root="timesheet">

    <element name="timesheet">
        <attribute name="name"
                   status="REQUIRED"/>
        <child element="day"
               repeating="True"/>
    </element">

    <element name="day">
        <attribute name="date"
                   status="REQUIRED"/>
        <child element="entry"
               repeating="True"/>
    </element">

    <element name="entry"
             content="EMPTY">
        <attribute name="hours"
                   status="REQUIRED"/>
        <attribute name="project"
                   status="REQUIRED"/>
    </element">

</qdml>

Here we have the complete QDML schema for the timesheet markup language. We have added the content model specification for the timesheet and day elements:

 

Attributes

 

Content Model: EMPTY

 

 
ELEMENT: selection
DTD: <!ELEMENT selection ((child|selection|sequence)+)> <!ATTLIST selection optional CDATA "False" repeating CDATA "False"> QDML: <element name="selection"> <attribute name="optional" value="False"/> <attribute name="repeating" value="False"/> <selection repeating="True"> <child element="child"/> <child element="selection"/> <child element="sequence"/> </selection> </element>

 

The selection element is used to introduce alternatives into a content model.

 

Sample XML

    <automobile>
        <standardTransmission/>
    </automobile>

QDML

    <element name="automobile">
        <selection>
            <child element="standardTransmission"/>
            <child element="automaticTransmission"/>
        </selection>
    </element">

Here we see a QDML fragment which specifies that an automobile element must contain either a standardTransmission element or an automaticTransmission element.

 

Attributes

The optional and repeating attributes are used to control the number of allowed occurances of the alternatives specified by the child and sequence elements contained in the selection element:

optional repeating Number of Occurances
True True Zero or more
False False Exactly one
True False No more than one
False True One or more

These attributes both default to False when not present.

 

Content Model

The child, selection, and sequence elements are used to specify alternative content models.

These elements are optional, repeatable, and can occur in any order, so long as there is at least one element present in the selection element's content.

 

 
ELEMENT: sequence
DTD: <!ELEMENT sequence ((child|selection|sequence)+)> <!ATTLIST sequence optional CDATA "False" repeating CDATA "False"> QDML: <element name="sequence"> <attribute name="optional" value="False"/> <attribute name="repeating" value="False"/> <selection repeating="True"> <child element="child"/> <child element="selection"/> <child element="sequence"/> </selection> </element>

 

The sequence element lets us define sequences in the content model.

 

Sample XML

<map name="Bill la Forge">
    <key>Fred Smith</key>
    <ssn>101-33-9320</ssn>
    <key>John Spade</key>
    <ssn>221-56-7890</ssn>
    <key>Big Little, Inc.</key>
    <cid>04-98789234</cid>
</map>

QDML

<qdml root="map">

    <element name="map">
        <sequence optional="True"
                  repeating="True">
            <child element="key"/>
            <selection>
                <child element="ssn"/>
                <child element="opaque"/>
            </selection>
        </sequence>
    </element>

    <element name="key"
             content="PCDATA"/>

    <element name="ssn"
             content="PCDATA"/>

    <element name="opaque"
             wild="True">
             content="BIMODAL">
        <attribute name="#ANY"/>
        <child element="opaque"
               optional="True" 
               repeating="True"/>
    </element>

</qdml>

Here we see the QDML schema for a MAP markup language. The content of the map element is specified as a repeating sequence of key/value pairs, where the value is either a ssn element or some undefined element.

 

Attributes

The optional and repeating attributes are used to control the number of allowed occurances of the sequence specified by the child, selection, and sequence elements contained in the sequence element:

optional repeating Number of Occurances
True True Zero or more
False False Exactly one
True False No more than one
False True One or more

These attributes both default to False when not present.

 

Content Model

The child, selection, and sequence elements are used to specify alternative content models.

These elements are optional, repeatable, and can occur in any order, so long as there is at least one child, selection, or sequence element present in the sequence element content.

 

 <Quick>  <JXML>  <Download>  <QJML>