DAP4: DDX Grammar

From OPeNDAP Documentation
Revision as of 22:51, 21 February 2012 by DennisHeimbigner (talk | contribs) (Created page with "'''Version: 1.0''' Below is the formal grammar for the DAP4 DXD. <pre> <!-- Relax NG Grammar --> <!--grammar datatypelibrary="http://opendap.org/DAP4/datatypes.xml"--> <grammar...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Version: 1.0

Below is the formal grammar for the DAP4 DXD.

<!-- Relax NG Grammar -->

<!--grammar datatypelibrary="http://opendap.org/DAP4/datatypes.xml"-->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<start>
  <element name="dataset">
    <ref name="groupdef"/>
  </element>
</start>

<define name="groupdef">
  <attribute name="name"/>
  <zeroOrMore>
    <element name="attribute"><ref name="attributedef"/></element>
  </zeroOrMore>
  <optional>
    <element name="dimensions">
      <zeroOrMore>
        <element name="dimension"><ref name="dimdef"/></element>
      </zeroOrMore>
    </element>
  </optional>
  <zeroOrMore>
    <element name="variable"><ref name="variabledef"/></element>
  </zeroOrMore>
  <zeroOrMore>
    <element name="group"><ref name="groupdef"/></element>
  </zeroOrMore>
</define>

<define name="dimdef">
    <attribute name="name"/>
    <attribute name="size"/>
    <zeroOrMore>
      <element name="attribute"><ref name="attributedef"/></element>
    </zeroOrMore>
</define>

<define name="variabledef">
  <attribute name="name"/>  
  <zeroOrMore>
    <element name="dimension">
      <attribute name="name"/>
    </element>
  </zeroOrMore>
  <zeroOrMore>
    <element name="coordinatevar">
      <attribute name="name"/> 
    </element>
  </zeroOrMore>
  <choice>
  <attribute name="type"/>
  <element name="structure"><ref name="structuredef"/></element>
  <element name="sequence"><ref name="sequencedef"/></element>
  <element name="grid"><ref name="griddef"/></element>
  </choice>
  <zeroOrMore>
    <element name="attribute"><ref name="attributedef"/></element>
  </zeroOrMore>
</define>

<define name="structuredef">
  <attribute name="name"/>  
  <zeroOrMore>
    <element name="variable"><ref name="variabledef"/></element>
  </zeroOrMore>  
  <zeroOrMore>
    <element name="attribute"><ref name="attributedef"/></element>
  </zeroOrMore>
</define>

<define name="sequencedef">
  <attribute name="name"/>  
  <zeroOrMore>
    <element name="variable"><ref name="variabledef"/></element>
  </zeroOrMore>  
  <zeroOrMore>
    <element name="attribute"><ref name="attributedef"/></element>
  </zeroOrMore>
</define>

<define name="griddef">
  <attribute name="name"/>  
  <element name="array">
    <element name="variable"><ref name="variabledef"/></element>
  </element>
  <element name="maps">
    <zeroOrMore>
      <element name="variable"><ref name="variabledef"/></element>
    </zeroOrMore>  
  </element>
  <zeroOrMore>
    <element name="attribute"><ref name="attributedef"/></element>
  </zeroOrMore>
</define>

<define name="attributedef">
  <attribute name="name"/>
  <attribute name="type"/>
  <optional>
    <attribute name="namespace"/>
  </optional>
  <choice>
    <attribute name="value"/>
    <oneOrMore>
      <element name="value">
        <attribute name="value"/>
      </element>
    </oneOrMore>
  </choice>
</define>

</grammar>