schema Documentation

Revision History
Revision 0.12007-03-07Dave P
Initial Issue. Created with rng2xweb.xsl

Table of Contents

Start template
Pattern trigger.
Pattern mode
Pattern includedMode
Pattern rule
Pattern namespace
Pattern anyNamespace
Pattern ruleModel
Pattern elementsOrAttributes
Pattern actions
Pattern cancelAction
Pattern noResultAction
Pattern schema
Pattern message
Pattern resultAction
Pattern option
Pattern modeUsage
Pattern nestedMode
Pattern schemaType
Pattern mediaType
Pattern path
Pattern foreignElement
Pattern anyElement
Pattern foreignAttribute
Pattern foreign

Start template

The root element is identified from this content

Root element, rules. startMode must be present if the first child of rules is the mode element. This indicates which mode to start in.

Pattern trigger.

The trigger element enables sections to be created for validation based solely on element names

There are two required attributes on trigger. The ns attribute specifies the namespace and the nameList attribute is a space separated list of element local names.

         <define name="trigger">
            <element name="trigger">
               <attribute name="ns">
                  <data type="string"/>
               </attribute>
               <attribute name="nameList">
                  <list>
                     <oneOrMore>
                        <data type="NCName"/>
                     </oneOrMore>
                  </list>
               </attribute>
            </element>
         </define>
      

Pattern mode

Modes generally handle a single section, e.g. one namespace. Nodes may be nested. A mode is identified by its @id value. validate/@useMode specifies which mode is used when a nested section is encountered

         <define name="mode">
            <element name="mode">
               <attribute name="name">
                  <data type="NCName"/>
               </attribute>
               <zeroOrMore>
                  <ref name="includedMode"/>
               </zeroOrMore>
               <zeroOrMore>
                  <ref name="rule"/>
               </zeroOrMore>
            </element>
         </define>
      

Pattern includedMode

A nested mode containing more rules

         <define name="includedMode">
            <element name="mode">
               <optional>
                  <attribute name="name">
                     <data type="NCName"/>
                  </attribute>
               </optional>
               <zeroOrMore>
                  <ref name="includedMode"/>
               </zeroOrMore>
               <zeroOrMore>
                  <ref name="rule"/>
               </zeroOrMore>
            </element>
         </define>
      

Pattern rule

A generic rule. A rule is a condition and one or more actions. A rule contains either a namespace or a anyNamespace child. This child is the condition.

         <define name="rule">
            <choice>
               <ref name="namespace"/>
               <ref name="anyNamespace"/>
            </choice>
         </define>
      

Pattern namespace

A namespace element, where the ns attribute specifies the namespace.

         <define name="namespace">
            <element name="namespace">
               <attribute name="ns">
                  <data type="string"/>
               </attribute>
               <optional>
                  <attribute name="wildCard">
                     <data type="string">
                        <param name="maxLength">1</param>
                     </data>
                  </attribute>
               </optional>
               <ref name="ruleModel"/>
            </element>
         </define>
      

Pattern anyNamespace

A condition which contains actions, true for any namespace match

         <define name="anyNamespace">
            <element name="anyNamespace">
               <ref name="ruleModel"/>
            </element>
         </define>
      

Pattern ruleModel

This pattern represents the action part of a rule. The match attribute specifies the match on either attributes or elements and the child specifies the action(s) to be taken.

         <define name="ruleModel">
            <optional>
               <attribute name="match">
                  <ref name="elementsOrAttributes"/>
               </attribute>
            </optional>
            <ref name="actions"/>
         </define>
      

Pattern elementsOrAttributes

These are the allowed values of the match attribute on the the section called “Pattern namespace” or the section called “Pattern anyNamespace” element. The values are either elements or attributes.

         <define name="elementsOrAttributes">
            <list>
               <choice>
                  <group>
                     <value>elements</value>
                     <value>attributes</value>
                  </group>
                  <group>
                     <value>attributes</value>
                     <value>elements</value>
                  </group>
                  <value>elements</value>
                  <value>attributes</value>
               </choice>
            </list>
         </define>
      

Pattern actions

This pattern collates the choice of actions for a rule. The options are the section called “Pattern cancelAction”, the section called “Pattern noResultAction” or the section called “Pattern resultAction”.

         <define name="actions">
            <choice>
               <ref name="cancelAction"/>
               <group>
                  <zeroOrMore>
                     <ref name="noResultAction"/>
                  </zeroOrMore>
                  <choice>
                     <ref name="noResultAction"/>
                     <ref name="resultAction"/>
                  </choice>
                  <zeroOrMore>
                     <ref name="noResultAction"/>
                  </zeroOrMore>
               </group>
            </choice>
         </define>
      

Pattern cancelAction

This element must be the single child of a rule, it prevents any action from being executed.

         <define name="cancelAction">
            <element name="cancelNestedActions">
               <empty/>
            </element>
         </define>
      

Pattern noResultAction

This pattern is the base action pattern. It contains the validate action and the allow or reject elements.

         <define name="noResultAction">
            <choice>
               <element name="validate">
                  <optional>
                     <ref name="schemaType"/>
                  </optional>
                  <zeroOrMore>
                     <choice>
                        <ref name="message"/>
                        <ref name="option"/>
                     </choice>
                  </zeroOrMore>
                  <ref name="schema"/>
                  <ref name="modeUsage"/>
               </element>
               <element>
                  <choice>
                     <name>allow</name>
                     <name>reject</name>
                  </choice>
                  <zeroOrMore>
                     <ref name="message"/>
                  </zeroOrMore>
                  <ref name="modeUsage"/>
               </element>
            </choice>
         </define>
      

Pattern schema

The schema attribute on the section called “Pattern noResultAction”, or the schema element specifies the schema to use for validation.

         <define name="schema">
            <choice>
               <attribute name="schema">
                  <data type="anyURI"/>
               </attribute>
               <element name="schema">
                  <choice>
                     <text/>
                     <ref name="foreignElement"/>
                  </choice>
               </element>
            </choice>
         </define>
      

Pattern message

The message pattern can be used as either an attribute or a child element in many places to document the validation process.

         <define name="message">
            <choice>
               <attribute name="message"/>
               <element name="message">
                  <interleave>
                     <text/>
                     <optional>
                        <attribute name="xml:lang"/>
                     </optional>
                  </interleave>
               </element>
            </choice>
         </define>
      

Pattern resultAction

One of the possible actions. These are one from attach, attachPlaceholder and unwrap.

         <define name="resultAction">
            <element>
               <choice>
                  <name>attach</name>
                  <name>attachPlaceholder</name>
                  <name>unwrap</name>
               </choice>
               <zeroOrMore>
                  <ref name="message"/>
               </zeroOrMore>
               <ref name="modeUsage"/>
            </element>
         </define>
      

Pattern option

The option element passes options to a validator, using the name and arg attributes. The mustSupport attribute indicates if these options must be supported for the validation to be effective.

         <define name="option">
            <element name="option">
               <attribute name="name">
                  <data type="anyURI"/>
               </attribute>
               <optional>
                  <attribute name="arg"/>
               </optional>
               <optional>
                  <attribute name="mustSupport">
                     <data type="boolean"/>
                  </attribute>
               </optional>
            </element>
         </define>
      

Pattern modeUsage

The modeUsage pattern contains the useMode attribute or nested mode children. Also context element children

         <define name="modeUsage">
            <optional>
               <choice>
                  <attribute name="useMode">
                     <data type="NCName"/>
                  </attribute>
                  <ref name="nestedMode"/>
               </choice>
            </optional>
            <zeroOrMore>
               <element name="context">
                  <attribute name="path">
                     <ref name="path"/>
                  </attribute>
                  <optional>
                     <choice>
                        <attribute name="useMode">
                           <data type="NCName"/>
                        </attribute>
                        <ref name="nestedMode"/>
                     </choice>
                  </optional>
               </element>
            </zeroOrMore>
         </define>
      

Pattern nestedMode

Modes may be nested. This pattern is the inner mode element, which again may contain further modes.

         <define name="nestedMode">
            <element name="mode">
               <zeroOrMore>
                  <ref name="includedMode"/>
               </zeroOrMore>
               <zeroOrMore>
                  <ref name="rule"/>
               </zeroOrMore>
            </element>
         </define>
      

Pattern schemaType

The schematype attribute specifies the media type of the schema to be used on a the section called “Pattern noResultAction” element.

         <define name="schemaType">
            <attribute name="schemaType">
               <ref name="mediaType"/>
            </attribute>
         </define>
      

Pattern mediaType

The mediaType data pattern. An example is application/x-rnc .

         <define name="mediaType">
            <a:documentation>
	   5.1 of RFC 2045 allows <any (US-ASCII) CHAR except
	   SPACE, CTLs, or tspecials>, where

    tspecials :=  "(" / ")" / "<" / ">" / "@" /
                  "," / ";" / ":" / "\" / <">
                  "/" / "[" / "]" / "?" / "="
	 </a:documentation>
            <data type="string">
               <param name="pattern">\s*[0-9A-Za-z!#$%&'\*\+\-\.\^_`\{\|\}~]*/[0-9A-Za-z!#$%&'\*\+\-\.\^_`\{\|\}~]*\s*</param>
            </data>
         </define>
      

Pattern path

The grammar for the simplified XPATH syntax used on the path attribute of the context element

         <define name="path">
            <data type="string">
               <param name="pattern">\s*(/\s*)?\i\c*(\s*/\s*\i\c*)*\s*(\|\s*(/\s*)?\i\c*(\s*/\s*\i\c*)*\s*)*</param>
            </data>
         </define>
      

Pattern foreignElement

Content in other namespaces is valid in many places. See the schema for details.

         <define name="foreignElement">
            <element>
               <anyName>
                  <except>
                     <nsName/>
                  </except>
               </anyName>
               <zeroOrMore>
                  <attribute>
                     <anyName/>
                  </attribute>
               </zeroOrMore>
               <mixed>
                  <zeroOrMore>
                     <ref name="anyElement"/>
                  </zeroOrMore>
               </mixed>
            </element>
         </define>
      

Pattern anyElement

Any element in any namespace

         <define name="anyElement">
            <element>
               <anyName/>
               <zeroOrMore>
                  <attribute>
                     <anyName/>
                  </attribute>
               </zeroOrMore>
               <mixed>
                  <zeroOrMore>
                     <ref name="anyElement"/>
                  </zeroOrMore>
               </mixed>
            </element>
         </define>
      

Pattern foreignAttribute

Any attribute not in the default namespace

         <define name="foreignAttribute">
            <attribute>
               <anyName>
                  <except>
                     <nsName/>
                     <nsName ns=""/>
                  </except>
               </anyName>
            </attribute>
         </define>
      

Pattern foreign

The foreign pattern combines the foreign elements and attributes.

         <define name="foreign">
            <zeroOrMore>
               <ref name="foreignAttribute"/>
            </zeroOrMore>
            <zeroOrMore>
               <ref name="foreignElement"/>
            </zeroOrMore>
         </define>