Powered by SmartDoc

meta option

Example

List 35.2.1.1[meta.rng] is a sample RELAX NG schema.

meta.rng
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <start>
    <ref name="account"/>
  </start>
  <define name="account">
    <element name="account">
      <attribute name="accountNo">
        <data type="token"/>
      </attribute>
      <element name="balance">
        <data type="int"/>
      </element>
      <element name="owner">
        <data type="token"/>
      </element>
      <ref name="address"/>
      <zeroOrMore>
        <ref name="phone"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="address">
    <element name="address">
      <attribute name="zip">
        <data type="token"/>
      </attribute>
      <text/>
    </element>
  </define>
  <define name="phone">
    <element name="phone">
      <attribute name="area">
        <data type="token"/>
      </attribute>
      <data type="token"/>
    </element>
  </define>
</grammar>

An artifact from the Meta generator is shown in List 35.2.1.2[meta.rxmeta].

meta.rxmeta
<?xml version='1.0' ?>
<grammar xmlns="http://www.relaxer.org/xmlns/RelaxerModel">
  <topLevel></topLevel>
  <module exports="M1E1" namespace="">
    <element id="M1E1" label="account" name="account">
      <attributeSlot name="accountNo" required="true">
        <datatype list="false" name="token"></datatype>
      </attributeSlot>
      <elementSlot name="balance" occurs="">
        <datatype list="false" name="int"></datatype>
      </elementSlot>
      <elementSlot name="owner" occurs="">
        <datatype list="false" name="token"></datatype>
      </elementSlot>
      <elementRef idref="M1E4" label="address" occurs=""></elementRef>
      <elementRef idref="M1E5" label="phone" occurs="*"></elementRef>
    </element>
    <element id="M1E4" label="address" name="address">
      <datatype list="false" name="string"></datatype>
      <attributeSlot name="zip" required="true">
        <datatype list="false" name="token"></datatype>
      </attributeSlot>
    </element>
    <element id="M1E5" label="phone" name="phone">
      <datatype list="false" name="token"></datatype>
      <attributeSlot name="area" required="true">
        <datatype list="false" name="token"></datatype>
      </attributeSlot>
    </element>
  </module>
</grammar>