<?xml version="1.0"?>
<!-- This was generated automatically from (a slightly bug-fixed
     version of) relaxCore.rlx. -->
<grammar ns="http://www.xml.gr.jp/xmlns/relaxCore"
         xmlns="http://www.thaiopensource.com/trex"
         xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">
   <start>
      <ref name="module.label"/>
   </start>
   <annotation xmlns="http://www.xml.gr.jp/xmlns/relaxCore">
      
      <documentation>The overall structure of RELAX modules</documentation>
   
   </annotation>
   <define name="module.label">
      <element name="module">
         <ref name="module.role"/>
         <group>
            <optional>
               <ref name="annotation.label"/>
            </optional>
            <optional>
               <ref name="interface.label"/>
            </optional>
            <zeroOrMore>
               <choice>
                  <ref name="clause.label"/>
                  <ref name="rule.label"/>
                  <ref name="divInModule.label"/>
                  <ref name="include.label"/>
               </choice>
            </zeroOrMore>
         </group>
      </element>
   </define>
   <define name="module.role">
      <annotation xmlns="http://www.xml.gr.jp/xmlns/relaxCore">
         
         <documentation>Namespace declarations cannot be controlled by
	       RELAX Core.  Wait for RELAX modularization.</documentation>
      
      </annotation>
      <optional>
         <attribute name="moduleVersion">
            <anyString/>
         </attribute>
      </optional>
      <optional>
         <attribute name="relaxCoreVersion">
            <anyString/>
         </attribute>
      </optional>
      <optional>
         <attribute name="targetNamespace">
            <data type="xsd:uriReference"/>
         </attribute>
      </optional>
   </define>
   <define name="interface.label">
      <element name="interface">
         <ref name="interface.role"/>
         <group>
            <optional>
               <ref name="annotation.label"/>
            </optional>
            <zeroOrMore>
               <choice>
                  <ref name="export.label"/>
                  <ref name="divInInterface.label"/>
               </choice>
            </zeroOrMore>
         </group>
      </element>
   </define>
   <define name="interface.role">
      <empty/>
   </define>
   <define name="clause.label">
      <choice>
         <ref name="tag.label"/>
         <ref name="attPool.label"/>
      </choice>
   </define>
   <define name="rule.label">
      <choice>
         <ref name="elementRule.label"/>
         <ref name="hedgeRule.label"/>
      </choice>
   </define>
   <define name="divInModule.label">
      <element name="div">
         <annotation xmlns="http://www.xml.gr.jp/xmlns/relaxCore">
               
            <documentation>div elements in modules</documentation>
            
         </annotation>
         <group>
            <optional>
               <ref name="annotation.label"/>
            </optional>
            <zeroOrMore>
               <choice>
                  <ref name="rule.label"/>
                  <ref name="clause.label"/>
                  <ref name="divInModule.label"/>
                  <ref name="include.label"/>
               </choice>
            </zeroOrMore>
         </group>
      </element>
   </define>
   <annotation xmlns="http://www.xml.gr.jp/xmlns/relaxCore">
      
      <documentation>Interface</documentation>
   
   </annotation>
   <define name="export.label">
      <element name="export">
         <ref name="export.role"/>
         <optional>
            <ref name="annotation.label"/>
         </optional>
      </element>
   </define>
   <define name="export.role">
      <attribute name="label">
         <data type="xsd:NMTOKEN"/>
      </attribute>
   </define>
   <define name="divInInterface.label">
      <element name="div">
         <annotation xmlns="http://www.xml.gr.jp/xmlns/relaxCore">
               
            <documentation>div elements in interfaces</documentation>
            
         </annotation>
         <group>
            <optional>
               <ref name="annotation.label"/>
            </optional>
            <zeroOrMore>
               <choice>
                  <ref name="export.label"/>
                  <ref name="divInInterface.label"/>
               </choice>
            </zeroOrMore>
         </group>
      </element>
   </define>
   <annotation xmlns="http://www.xml.gr.jp/xmlns/relaxCore">
      
      <documentation>Include</documentation>
   
   </annotation>
   <define name="include.label">
      <element name="include">
         <ref name="include.role"/>
         <optional>
            <ref name="annotation.label"/>
         </optional>
      </element>
   </define>
   <define name="include.role">
      <optional>
         <attribute name="moduleLocation">
            <data type="xsd:uriReference"/>
         </attribute>
      </optional>
   </define>
   <annotation xmlns="http://www.xml.gr.jp/xmlns/relaxCore">
      
      <documentation>Hedge Models</documentation>
   
   </annotation>
   <define name="particle.label">
      <choice>
         <annotation xmlns="http://www.xml.gr.jp/xmlns/relaxCore">
            
            <documentation>This is used to describe element hedge models.
	It is also used as subordinates of &lt;sequence&gt;,
	&lt;choice&gt;, and &lt;mixed&gt;.
	</documentation>
         
         </annotation>
         <choice>
            <ref name="refWithLabel.label"/>
            <ref name="hedgeRef.label"/>
            <ref name="choice.label"/>
            <ref name="sequence.label"/>
            <ref name="element.label"/>
            <ref name="none.label"/>
            <ref name="empty.label"/>
         </choice>
      </choice>
   </define>
   <define name="hedgeModel.label">
      <choice>
         <ref name="particle.label"/>
         <ref name="mixed.label"/>
      </choice>
   </define>
   <define name="repeatable.role">
      <annotation xmlns="http://www.xml.gr.jp/xmlns/relaxCore">
         
         <documentation>This is used to specify the "occurs" attribute,
	which is shared by several elements.</documentation>
      
      </annotation>
      <optional>
         <attribute name="occurs">
            <choice>
               <string>?</string>
               <string>*</string>
               <string>+</string>
            </choice>
         </attribute>
      </optional>
   </define>
   <define name="hedgeRef.label">
      <element name="hedgeRef">
         <ref name="hedgeRef.role"/>
      </element>
   </define>
   <define name="hedgeRef.role">
      <ref name="repeatable.role"/>
      <attribute name="label">
         <data type="xsd:NCName"/>
      </attribute>
   </define>
   <define name="refWithLabel.label">
      <element name="ref">
         <ref name="repeatable.role"/>
         <attribute name="label">
            <data type="xsd:NCName"/>
         </attribute>
      </element>
   </define>
   <define name="empty.label">
      <element name="empty">
         <ref name="empty.role"/>
      </element>
   </define>
   <define name="empty.role">
      <empty/>
   </define>
   <define name="choice.label">
      <element name="choice">
         <ref name="choice.role"/>
         <zeroOrMore>
            <ref name="particle.label"/>
         </zeroOrMore>
      </element>
   </define>
   <define name="choice.role">
      <ref name="repeatable.role"/>
   </define>
   <define name="sequence.label">
      <element name="sequence">
         <ref name="sequence.role"/>
         <zeroOrMore>
            <ref name="particle.label"/>
         </zeroOrMore>
      </element>
   </define>
   <define name="sequence.role">
      <ref name="repeatable.role"/>
   </define>
   <define name="none.label">
      <element name="none">
         <ref name="none.role"/>
      </element>
   </define>
   <define name="none.role">
      <empty/>
   </define>
   <define name="mixed.label">
      <element name="mixed">
         <ref name="mixed.role"/>
         <ref name="particle.label"/>
      </element>
   </define>
   <define name="mixed.role">
      <empty/>
   </define>
   <define name="element.label">
      <choice>
         <element name="element">
            <ref name="repeatable.role"/>
            <attribute name="name">
               <data type="xsd:NCName"/>
            </attribute>
            <attribute name="label">
               <data type="xsd:NCName"/>
            </attribute>
            <annotation xmlns="http://www.xml.gr.jp/xmlns/relaxCore">
               
               <documentation>with the label attribute</documentation>
            
            </annotation>
            <group>
               <optional>
                  <ref name="annotation.label"/>
               </optional>
               <zeroOrMore>
                  <ref name="facet.label"/>
               </zeroOrMore>
            </group>
         </element>
         <element name="element">
            <ref name="repeatable.role"/>
            <attribute name="name">
               <data type="xsd:NCName"/>
            </attribute>
            <attribute name="type">
               <data type="xsd:NCName"/>
            </attribute>
            <annotation xmlns="http://www.xml.gr.jp/xmlns/relaxCore">
               
               <documentation>with the type attribute</documentation>
            
            </annotation>
            <group>
               <optional>
                  <ref name="annotation.label"/>
               </optional>
               <zeroOrMore>
                  <ref name="facet.label"/>
               </zeroOrMore>
            </group>
         </element>
      </choice>
   </define>
   <annotation xmlns="http://www.xml.gr.jp/xmlns/relaxCore">
      
      <documentation>Rules</documentation>
   
   </annotation>
   <define name="elementRule.label">
      <choice>
         <element name="elementRule">
            <attribute name="role">
               <data type="xsd:NCName"/>
            </attribute>
            <optional>
               <attribute name="label">
                  <data type="xsd:NCName"/>
               </attribute>
            </optional>
            <attribute name="type">
               <data type="xsd:NCName"/>
            </attribute>
            <annotation xmlns="http://www.xml.gr.jp/xmlns/relaxCore">
               
               <documentation>without embedded tag or attPool elements</documentation>
               
               <documentation>with the type attribute</documentation>
            
            </annotation>
            <optional>
               <ref name="annotation.label"/>
            </optional>
         </element>
         <element name="elementRule">
            <attribute name="label">
               <data type="xsd:NCName"/>
            </attribute>
            <attribute name="type">
               <data type="xsd:NCName"/>
            </attribute>
            <annotation xmlns="http://www.xml.gr.jp/xmlns/relaxCore">
               
               <documentation>with embedded tag or attPool elements</documentation>
               
               <documentation>with the type attribute</documentation>
            
            </annotation>
            <group>
               <optional>
                  <ref name="annotation.label"/>
               </optional>
               <choice>
                  <oneOrMore>
                     <ref name="tagInRule.label"/>
                  </oneOrMore>
                  <oneOrMore>
                     <ref name="attPoolInRule.label"/>
                  </oneOrMore>
               </choice>
            </group>
         </element>
         <element name="elementRule">
            <attribute name="role">
               <data type="xsd:NCName"/>
            </attribute>
            <optional>
               <attribute name="label">
                  <data type="xsd:NCName"/>
               </attribute>
            </optional>
            <annotation xmlns="http://www.xml.gr.jp/xmlns/relaxCore">
               
               <documentation>without embedded tag or attPool elements</documentation>
               
               <documentation>with a hedge model</documentation>
            
            </annotation>
            <group>
               <optional>
                  <ref name="annotation.label"/>
               </optional>
               <ref name="hedgeModel.label"/>
            </group>
         </element>
         <element name="elementRule">
            <attribute name="label">
               <data type="xsd:NCName"/>
            </attribute>
            <annotation xmlns="http://www.xml.gr.jp/xmlns/relaxCore">
               
               <documentation>with embedded tag or attPool elements</documentation>
               
               <documentation>with a hedge model</documentation>
            
            </annotation>
            <group>
               <optional>
                  <ref name="annotation.label"/>
               </optional>
               <choice>
                  <oneOrMore>
                     <ref name="tagInRule.label"/>
                  </oneOrMore>
                  <oneOrMore>
                     <ref name="attPoolInRule.label"/>
                  </oneOrMore>
               </choice>
               <ref name="hedgeModel.label"/>
            </group>
         </element>
      </choice>
   </define>
   <define name="hedgeRule.label">
      <element name="hedgeRule">
         <ref name="hedgeRule.role"/>
         <group>
            <optional>
               <ref name="annotation.label"/>
            </optional>
            <ref name="hedgeModel.label"/>
         </group>
      </element>
   </define>
   <define name="hedgeRule.role">
      <attribute name="label">
         <data type="xsd:NCName"/>
      </attribute>
   </define>
   <annotation xmlns="http://www.xml.gr.jp/xmlns/relaxCore">
      
      <documentation>Clauses</documentation>
   
   </annotation>
   <define name="clauseBody.label">
      <group>
         <optional>
            <ref name="annotation.label"/>
         </optional>
         <zeroOrMore>
            <ref name="refWithRole.label"/>
         </zeroOrMore>
         <zeroOrMore>
            <ref name="attribute.label"/>
         </zeroOrMore>
      </group>
   </define>
   <define name="tag.label">
      <element name="tag">
         <ref name="tag.role"/>
         <ref name="clauseBody.label"/>
      </element>
   </define>
   <define name="tag.role">
      <optional>
         <attribute name="role">
            <data type="xsd:NCName"/>
         </attribute>
      </optional>
      <attribute name="name">
         <data type="xsd:NCName"/>
      </attribute>
   </define>
   <define name="tagInRule.label">
      <element name="tag">
         <attribute name="name">
            <data type="xsd:NCName"/>
         </attribute>
         <annotation xmlns="http://www.xml.gr.jp/xmlns/relaxCore">
               
            <documentation>tag elements embedded in	elementRules</documentation>
            
         </annotation>
         <ref name="clauseBody.label"/>
      </element>
   </define>
   <define name="attPool.label">
      <element name="attPool">
         <ref name="attPool.role"/>
         <ref name="clauseBody.label"/>
      </element>
   </define>
   <define name="attPool.role">
      <attribute name="role">
         <data type="xsd:NCName"/>
      </attribute>
   </define>
   <define name="attPoolInRule.label">
      <element name="attPool">
         <annotation xmlns="http://www.xml.gr.jp/xmlns/relaxCore">
               
            <documentation>attPool elements embedded in elementRules</documentation>
            
         </annotation>
         <ref name="clauseBody.label"/>
      </element>
   </define>
   <define name="refWithRole.label">
      <element name="ref">
         <attribute name="role">
            <data type="xsd:NCName"/>
         </attribute>
      </element>
   </define>
   <define name="attribute.label">
      <element name="attribute">
         <ref name="attribute.role"/>
         <group>
            <optional>
               <ref name="annotation.label"/>
            </optional>
            <zeroOrMore>
               <ref name="facet.label"/>
            </zeroOrMore>
         </group>
      </element>
   </define>
   <define name="attribute.role">
      <attribute name="name">
         <data type="xsd:NMTOKEN"/>
      </attribute>
      <optional>
         <attribute name="type">
            <data type="xsd:NCName"/>
         </attribute>
      </optional>
      <optional>
         <attribute name="required">
            <string>true</string>
         </attribute>
      </optional>
   </define>
   <define name="minBound.label">
      <choice>
         <ref name="minInclusive.label"/>
         <ref name="minExclusive.label"/>
      </choice>
   </define>
   <define name="maxBound.label">
      <choice>
         <ref name="maxInclusive.label"/>
         <ref name="maxExclusive.label"/>
      </choice>
   </define>
   <define name="bounds.label">
      <choice>
         <ref name="minBound.label"/>
         <ref name="maxBound.label"/>
      </choice>
   </define>
   <define name="numeric.label">
      <choice>
         <ref name="precision.label"/>
         <ref name="scale.label"/>
      </choice>
   </define>
   <define name="ordered.label">
      <choice>
         <ref name="bounds.label"/>
         <ref name="numeric.label"/>
      </choice>
   </define>
   <define name="unordered.label">
      <choice>
         <ref name="pattern.label"/>
         <ref name="enumeration.label"/>
         <ref name="length.label"/>
         <ref name="maxLength.label"/>
         <ref name="minLength.label"/>
         <ref name="encoding.label"/>
         <ref name="period.label"/>
         <ref name="duration.label"/>
      </choice>
   </define>
   <define name="facet.label">
      <choice>
         <ref name="ordered.label"/>
         <ref name="unordered.label"/>
      </choice>
   </define>
   <define name="facetModel.label">
      <optional>
         <ref name="annotation.label"/>
      </optional>
   </define>
   <define name="facetAttrs.role">
      <attribute name="value">
         <anyString/>
      </attribute>
   </define>
   <define name="maxExclusive.label">
      <element name="maxExclusive">
         <ref name="maxExclusive.role"/>
         <ref name="facetModel.label"/>
      </element>
   </define>
   <define name="maxExclusive.role">
      <ref name="facetAttrs.role"/>
   </define>
   <define name="minExclusive.label">
      <element name="minExclusive">
         <ref name="minExclusive.role"/>
         <ref name="facetModel.label"/>
      </element>
   </define>
   <define name="minExclusive.role">
      <ref name="facetAttrs.role"/>
   </define>
   <define name="maxInclusive.label">
      <element name="maxInclusive">
         <ref name="maxInclusive.role"/>
         <ref name="facetModel.label"/>
      </element>
   </define>
   <define name="maxInclusive.role">
      <ref name="facetAttrs.role"/>
   </define>
   <define name="minInclusive.label">
      <element name="minInclusive">
         <ref name="minInclusive.role"/>
         <ref name="facetModel.label"/>
      </element>
   </define>
   <define name="minInclusive.role">
      <ref name="facetAttrs.role"/>
   </define>
   <define name="precision.label">
      <element name="precision">
         <ref name="precision.role"/>
         <ref name="facetModel.label"/>
      </element>
   </define>
   <define name="precision.role">
      <attribute name="value">
         <data type="xsd:positiveInteger"/>
      </attribute>
   </define>
   <define name="scale.label">
      <element name="scale">
         <ref name="scale.role"/>
         <ref name="facetModel.label"/>
      </element>
   </define>
   <define name="scale.role">
      <attribute name="value">
         <data type="xsd:nonNegativeInteger"/>
      </attribute>
   </define>
   <define name="length.label">
      <element name="length">
         <ref name="length.role"/>
         <ref name="facetModel.label"/>
      </element>
   </define>
   <define name="length.role">
      <attribute name="value">
         <data type="xsd:nonNegativeInteger"/>
      </attribute>
   </define>
   <define name="minLength.label">
      <element name="minLength">
         <ref name="minLength.role"/>
         <ref name="facetModel.label"/>
      </element>
   </define>
   <define name="minLength.role">
      <attribute name="value">
         <data type="xsd:nonNegativeInteger"/>
      </attribute>
   </define>
   <define name="maxLength.label">
      <element name="maxLength">
         <ref name="maxLength.role"/>
         <ref name="facetModel.label"/>
      </element>
   </define>
   <define name="maxLength.role">
      <attribute name="value">
         <data type="xsd:nonNegativeInteger"/>
      </attribute>
   </define>
   <define name="enumeration.label">
      <element name="enumeration">
         <ref name="enumeration.role"/>
         <ref name="facetModel.label"/>
      </element>
   </define>
   <define name="enumeration.role">
      <ref name="facetAttrs.role"/>
   </define>
   <define name="pattern.label">
      <element name="pattern">
         <ref name="pattern.role"/>
         <ref name="facetModel.label"/>
      </element>
   </define>
   <define name="pattern.role">
      <ref name="facetAttrs.role"/>
   </define>
   <define name="encoding.label">
      <element name="encoding">
         <ref name="encoding.role"/>
         <ref name="facetModel.label"/>
      </element>
   </define>
   <define name="encoding.role">
      <attribute name="value">
         <choice>
            <string>hex</string>
            <string>base64</string>
         </choice>
      </attribute>
   </define>
   <define name="period.label">
      <element name="period">
         <ref name="period.role"/>
         <ref name="facetModel.label"/>
      </element>
   </define>
   <define name="period.role">
      <attribute name="value">
         <data type="xsd:timeDuration"/>
      </attribute>
   </define>
   <define name="duration.label">
      <element name="duration">
         <ref name="duration.role"/>
         <ref name="facetModel.label"/>
      </element>
   </define>
   <define name="duration.role">
      <ref name="facetAttrs.role"/>
   </define>
   <define name="annotation.label">
      <element name="annotation">
         <ref name="annotation.role"/>
         <zeroOrMore>
            <choice>
               <ref name="appinfo.label"/>
               <ref name="documentation.label"/>
            </choice>
         </zeroOrMore>
      </element>
   </define>
   <define name="annotation.role">
      <empty/>
   </define>
   <define name="appinfo.label">
      <element name="appinfo">
         <ref name="appinfo.role"/>
         <mixed>
            <empty/>
         </mixed>
      </element>
   </define>
   <define name="appinfo.role">
      <optional>
         <attribute name="source">
            <anyString/>
         </attribute>
      </optional>
   </define>
   <define name="documentation.label">
      <element name="documentation">
         <ref name="documentation.role"/>
         <mixed>
            <empty/>
         </mixed>
      </element>
   </define>
   <define name="documentation.role">
      <optional>
         <attribute name="source">
            <anyString/>
         </attribute>
      </optional>
      <optional>
         <attribute name="xml:lang">
            <anyString/>
         </attribute>
      </optional>
   </define>
</grammar>
