Appendix A: XFormsモデルのスキーマ


Contents

A.1 XFormsモデルスキーマ

<?xml version="1.0"?>
<xsd:schema targetNamespace="http://www.w3.org/2001/02/xforms"
xmlns:xform="http://www.w3.org/2001/02/xforms"
xmlns="http://www.w3.org/2001/02/xforms"
xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" elementFormDefault="qualified">
  <!--
  <xsd:schema> エレメントを使うためには、XMLSchemaのためのスキーマをインポートすること。
  -->
  <xsd:import namespace="http://www.w3.org/2000/10/XMLSchema"/>
  <!--

  XFormsの<model>エレメント、およびその中に含まれる
  全てのためのスキーマを定義する。これにはXFormsで定義された
  データ型と、動的な値をもち、実行時に変化しうるXForms仕様プロパティ
  が含まれる。ここにはもう1つのXMLシンタックスとして、
  XFormsモデルのエレメントの定義に用いることができる
  XFormsのsimpleシンタックスの定義も含まれる。

  -->
<!--

      XForms構造エレメント定義

  -->
<!--

  xformコンテナエレメントの定義

  -->
  <xsd:element name="xform">
    <xsd:complexType>
      <xsd:choice maxOccurs="unbounded">
        <xsd:element ref="model"/>
        <xsd:element ref="instance"/>
        <xsd:element ref="submit"/>
        <xsd:element ref="bind"/>
      </xsd:choice>
      <xsd:attribute name="id" type="xsd:ID" use="optional"/>
    </xsd:complexType>
  </xsd:element>
<!--

  トップレベルのmodelエレメントの定義

  -->
  <xsd:element name="model">
    <xsd:complexType>
       <xsd:choice>
        <xsd:element ref="xsd:schema"/>
        <xsd:element ref="simple"/>
        <xsd:sequence>
          <xsd:element ref="xsd:schema"/>
          <xsd:element ref="simple"/>
        </xsd:sequence>
      </xsd:choice>
      <xsd:attribute name="id" type="xsd:ID" use="optional"/>
      <xsd:attribute name="name" type="xsd:NCName" use="optional"/>
      <xsd:attribute name="href" type="xsd:uriReference" use="optional"/>
    </xsd:complexType>
  </xsd:element>
<!--

  トップレベルのinstanceエレメントの定義

  -->
  <xsd:element name="instance">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:any namespace="##other" processContents="skip"           maxOccurs="unbounded"/>
      </xsd:sequence>
      <xsd:attribute name="id" type="xsd:ID" use="optional"/>
      <xsd:attribute name="model" type="xsd:IDREF" use="optional"/>
      <xsd:attribute name="href" type="xsd:uriReference" use="optional"/>
    </xsd:complexType>
  </xsd:element>
<!--

  submitExtension エレメントの定義。
  SubmitExtension に含まれるエレメントはネームスペースをqualifyされていなければならない。
  模試ネームスペースが理解されず、かつmustUnderstand 属性がtrueにセットされていれば、そのSubmit の内容は使用されるべきではない。
  -->
  <!--  -->
  <xsd:element name="submitExtension">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:any namespace="##other" processContents="skip"/>
      </xsd:sequence>
      <xsd:attribute name="mustUnderstand" type="xsd:boolean" use="optional" value="true"/>
    </xsd:complexType>
  </xsd:element>
  <!--

  トップレベルのsubmitエレメントの定義

  -->
  <xsd:element name="submit">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="submitExtension" minOccurs="0" maxOccurs="unbounded"/>
        <!-- allow zero or more submitExtension elements -->
      </xsd:sequence>
      <xsd:attribute name="id" type="xsd:ID" use="optional"/>
      <xsd:attribute name="target" type="xsd:uriReference" use="required"/>
      <xsd:attribute name="method" type="xsd:string" use="optional"/>
    </xsd:complexType>
  </xsd:element>
<!--

  トップレベルのbindエレメントの定義

  -->
  <xsd:element name="bind">
    <xsd:complexType>
      <xsd:attribute name="id" type="xsd:ID" use="optional"/>
      <xsd:attribute name="ref" type="xsd:string" use="optional"/>
    </xsd:complexType>
  </xsd:element>
<!--

  XForms式型の定義。
  備考: もしXML Schemaを用いて実現する方法があった場合に
  (おそらく正しい文字列とパターンの組み合わせで可能である)、
  我々が式言語(expression language)にフィットするものを定義する際には、
  これは本当のXForm式型に置き換える必要がある。

  -->
  <xsd:simpleType name="xfmExpr">
    <xsd:restriction base="xsd:string"/>
  </xsd:simpleType>
<!--

  属性グループ定義で用いられるXForms型。
  備考: これらは全てxfmExprからの単純な派生型である。
  もしXML Schemaを用いてこれらを実現する方法があった場合には、
  我々は望まれた型の結果に強制するように変更しなければならない。

  -->
<!--
  
  String値を返さなければならない式で用いられる、stringExpr型の定義

  -->
  <xsd:simpleType name="stringExpr">
    <xsd:union memberTypes="xsd:string xfmExpr" />
  </xsd:simpleType>
<!--

  Boolean値を返さなければならない式で用いられる、boolExpr型の定義

  -->
  <xsd:simpleType name="boolExpr">
    <xsd:union memberTypes="xsd:boolean xfmExpr" />
  </xsd:simpleType>
<!--

  Number値を返さなければならない式で用いられる、numberExpr型の定義

  -->
  <xsd:simpleType name="numberExpr">
    <xsd:union memberTypes="xsd:decimal xfmExpr" />
  </xsd:simpleType>
<!--

  正の整数値を返さなければならない式で用いられる、positiveIntExpr型の定義
  
  -->
  <xsd:simpleType name="positiveIntExpr">
    <xsd:union memberTypes="xsd:positiveInteger xfmExpr" />
  </xsd:simpleType>
<!--

  Date値を返さなければならない式で用いられる、dateExpr型の定義

-->
  <xsd:simpleType name="dateExpr">
    <xsd:union memberTypes="xsd:date xfmExpr" />
  </xsd:simpleType>
<!--

  Time値を返さなければならない式で用いられる、timeExpr型の定義

-->
  <xsd:simpleType name="timeExpr">
    <xsd:union memberTypes="xsd:time xfmExpr" />
  </xsd:simpleType>
<!--

  Duration値を返さなければならない式で用いられる、durationExpr型の定義

-->
  <xsd:simpleType name="durationExpr">
    <xsd:union memberTypes="xsd:timeDuration xfmExpr" />
  </xsd:simpleType>
<!--

  任意の数のscheme値をもつリストを返さなければならない式で用いられる、
  schemeExpr型の定義。
  スキームはURIの値空間を特定のURIスキームに限定するために用いる。

-->
  <xsd:simpleType name="schemeType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[a-z]+"/>
    </xsd:restriction>
  </xsd:simpleType>
  <xsd:simpleType name="schemeExpr">
    <xsd:union memberTypes="schemeType xfmExpr" />
  </xsd:simpleType>
<!--

  URI値を返さなければならない式で用いられる、uriExpr型の定義

-->
  <xsd:simpleType name="uriExpr">
    <xsd:union memberTypes="xsd:uriReference xfmExpr" />
  </xsd:simpleType>
<!--

  任意の数のmediaType値をもつリストを返さなければならない式で
  用いられる、mediaTypeExpr型の定義。
  メディアタイプはバイナリエレメントの値空間を1つ以上のMIME
  メディアタイプに限定するために用いる。
  
-->
  <xsd:simpleType name="mediaTypeType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[a-z]+/[a-z]+"/>
    </xsd:restriction>
  </xsd:simpleType>
  <xsd:simpleType name="mediaTypeExpr">
    <xsd:union memberTypes="mediaTypeType xfmExpr" />
  </xsd:simpleType>
<!--

  Binary値を返さなければならない式で用いられる、binaryExpr型の定義

-->
  <xsd:simpleType name="binaryExpr">
    <xsd:union memberTypes="xsd:binary xfmExpr" />
  </xsd:simpleType>
<!--

  3文字からなる単一の通貨コードを返さなければならない式で用いられる、
  currencyType型の定義

-->
  <xsd:simpleType name="currencyType">
      <xsd:restriction base="xsd:string">
        <xsd:pattern value="[A-Z]{3}"/>
      </xsd:restriction>
  </xsd:simpleType>
<!--

  任意の数の3文字からなる通貨コードをもつリストを返さなければ
  ならない式で用いられる、currencyExpr型の定義

-->
  <xsd:simpleType name="currencyExpr">
    <xsd:union memberTypes="currencyType xfmExpr" />
  </xsd:simpleType>
<!--
    XForms仕様プロパティ属性グループ
  -->
  <xsd:attributeGroup name="XFSPcommonMinusEnum">
    <xsd:attribute name="id" type="xsd:ID" use="optional"/>
    <xsd:attribute name="required" type="boolExpr" 
      use="default" value="false"/>
    <xsd:attribute name="readOnly" type="boolExpr" 
      use="default" value="false"/>
    <xsd:attribute name="relevant" type="boolExpr" 
      use="default" value="true"/>
    <xsd:attribute name="validate" type="boolExpr" 
      use="default" value="true"/>
  </xsd:attributeGroup>
  <xsd:attributeGroup name="XFSPcommon">
    <xsd:attributeGroup ref="XFSPcommonMinusEnum"/>
    <xsd:attribute name="enum" use="optional">
      <xsd:simpleType>
        <xsd:restriction base="xsd:NMTOKEN">
          <xsd:enumeration value="open"/>
          <xsd:enumeration value="closed"/>
        </xsd:restriction>
      </xsd:simpleType>
    </xsd:attribute>
  </xsd:attributeGroup>
  <xsd:attributeGroup name="XFSPname">
    <xsd:attribute name="name" type="xsd:NCName" use="required"/>
  </xsd:attributeGroup>
  <xsd:attributeGroup name="XFSPcommonMinusEnumSimple">
    <xsd:attributeGroup ref="XFSPname"/>
    <xsd:attributeGroup ref="XFSPcommonMinusEnum"/>
  </xsd:attributeGroup>
  <xsd:attributeGroup name="XFSPcommonSimple">
    <xsd:attributeGroup ref="XFSPname"/>
    <xsd:attributeGroup ref="XFSPcommon"/>
  </xsd:attributeGroup>
<!--

  @calculateと@choicesを定義する属性グループ。
  choicesは列挙された、実行時の適切に型付けされた値のリストを返す式。
  calculateは実行時の正しい型の値を1つ返す。

-->
  <xsd:attributeGroup name="XFSPcalcAndChoices">
    <xsd:attribute name="calculate" type="xfmExpr" use="optional"/>
    <xsd:attribute name="choices" type="xfmExpr" use="optional"/>
  </xsd:attributeGroup>
  <xsd:attributeGroup name="XFSPcalcAndChoicesString">
    <xsd:attribute name="calculate" type="stringExpr" use="optional"/>
    <xsd:attribute name="choices" type="stringExpr" use="optional"/>
  </xsd:attributeGroup>
  <xsd:attributeGroup name="XFSPcalcAndChoicesBoolean">
    <xsd:attribute name="calculate" type="boolExpr" use="optional"/>
    <xsd:attribute name="choices" type="boolExpr" use="optional"/>
  </xsd:attributeGroup>
  <xsd:attributeGroup name="XFSPcalcAndChoicesNumber">
    <xsd:attribute name="calculate" type="numberExpr" use="optional"/>
    <xsd:attribute name="choices" type="numberExpr" use="optional"/>
  </xsd:attributeGroup>
  <xsd:attributeGroup name="XFSPcalcAndChoicesDate">
    <xsd:attribute name="calculate" type="dateExpr" use="optional"/>
    <xsd:attribute name="choices" type="dateExpr" use="optional"/>
  </xsd:attributeGroup>
  <xsd:attributeGroup name="XFSPcalcAndChoicesTime">
    <xsd:attribute name="calculate" type="timeExpr" use="optional"/>
    <xsd:attribute name="choices" type="timeExpr" use="optional"/>
  </xsd:attributeGroup>
  <xsd:attributeGroup name="XFSPcalcAndChoicesDuration">
    <xsd:attribute name="calculate" type="durationExpr" use="optional"/>
    <xsd:attribute name="choices" type="durationExpr" use="optional"/>
  </xsd:attributeGroup>
  <xsd:attributeGroup name="XFSPcalcAndChoicesURI">
    <xsd:attribute name="calculate" type="uriExpr" use="optional"/>
    <xsd:attribute name="choices" type="uriExpr" use="optional"/>
  </xsd:attributeGroup>
  <xsd:attributeGroup name="XFSPcalcAndChoicesBinary">
    <xsd:attribute name="calculate" type="binaryExpr" use="optional"/>
    <xsd:attribute name="choices" type="binaryExpr" use="optional"/>
  </xsd:attributeGroup>
  <xsd:attributeGroup name="XFSPcalcAndChoicesCurrency">
    <xsd:attribute name="calculate" type="currencyExpr" use="optional"/>
    <xsd:attribute name="choices" type="currencyExpr" use="optional"/>
  </xsd:attributeGroup>
  <!-- NumberおよびMoneyに適用 -->
  <xsd:attributeGroup name="XFSPmmNumber">
    <xsd:attribute name="minInclusive" type="numberExpr" use="optional"/>
    <xsd:attribute name="minExclusive" type="numberExpr" use="optional"/>
    <xsd:attribute name="maxInclusive" type="numberExpr" use="optional"/>
    <xsd:attribute name="maxExclusive" type="numberExpr" use="optional"/>
  </xsd:attributeGroup>
  <!--
  -->
  <xsd:attributeGroup name="XFSPmmNumberSimple">
    <xsd:attribute name="min" type="numberExpr" use="optional"/>
    <xsd:attribute name="max" type="numberExpr" use="optional"/>
  </xsd:attributeGroup>
  <!--
  -->
  <!-- Dateに適用 -->
  <xsd:attributeGroup name="XFSPmmDate">
    <xsd:attribute name="minInclusive" type="dateExpr" use="optional"/>
    <xsd:attribute name="minExclusive" type="dateExpr" use="optional"/>
    <xsd:attribute name="maxInclusive" type="dateExpr" use="optional"/>
    <xsd:attribute name="maxExclusive" type="dateExpr" use="optional"/>
  </xsd:attributeGroup>
<!--
 -->
  <xsd:attributeGroup name="XFSPmmDateSimple">
    <xsd:attribute name="min" type="dateExpr" use="optional"/>
    <xsd:attribute name="max" type="dateExpr" use="optional"/>
  </xsd:attributeGroup>
<!--
  -->
<!-- Durationに適用 -->
  <xsd:attributeGroup name="XFSPmmDuration">
    <xsd:attribute name="minInclusive" type="durationExpr" use="optional"/>
    <xsd:attribute name="minExclusive" type="durationExpr" use="optional"/>
    <xsd:attribute name="maxInclusive" type="durationExpr" use="optional"/>
    <xsd:attribute name="maxExclusive" type="durationExpr" use="optional"/>
  </xsd:attributeGroup>
<!--
  -->
  <xsd:attributeGroup name="XFSPmmDurationSimple">
    <xsd:attribute name="min" type="durationExpr" use="optional"/>
    <xsd:attribute name="max" type="durationExpr" use="optional"/>
  </xsd:attributeGroup>
<!--
  -->
<!-- Timeに適用 -->
  <xsd:attributeGroup name="XFSPmmTime">
    <xsd:attribute name="minInclusive" type="timeExpr" use="optional"/>
    <xsd:attribute name="minExclusive" type="timeExpr" use="optional"/>
    <xsd:attribute name="maxInclusive" type="timeExpr" use="optional"/>
    <xsd:attribute name="maxExclusive" type="timeExpr" use="optional"/>
  </xsd:attributeGroup>
<!--
  -->
  <xsd:attributeGroup name="XFSPmmTimeSimple">
    <xsd:attribute name="min" type="timeExpr" use="optional"/>
    <xsd:attribute name="max" type="timeExpr" use="optional"/>
  </xsd:attributeGroup>
<!--
  -->
<!-- String, Binary, URIに適用 -->
  <xsd:attributeGroup name="XFSPlengthNumber">
    <xsd:attribute name="length" type="positiveIntExpr" use="optional"/>
    <xsd:attribute name="minLength" type="positiveIntExpr" use="optional"/>
    <xsd:attribute name="maxLength" type="positiveIntExpr" use="optional"/>
  </xsd:attributeGroup>
<!--
  -->
  <!-- NumberおよびMoneyに適用 -->
  <xsd:attributeGroup name="XFSPspNumber">
    <xsd:attribute name="scale" type="positiveIntExpr" use="optional"/>
    <xsd:attribute name="precision" type="positiveIntExpr" use="optional"/>
  </xsd:attributeGroup>
<!--

  スキーマシンタックスによる、モデルのためのXForms基本データ型

-->
<!--

  string型の定義

-->
  <xsd:complexType name="string">
    <xsd:simpleContent>
      <xsd:extension base="xsd:string">
        <xsd:attributeGroup ref="XFSPcommon"/>
        <xsd:attributeGroup ref="XFSPlengthNumber"/>
        <xsd:attributeGroup ref="XFSPcalcAndChoicesString"/>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>
<!--

  boolean型の定義

-->
  <xsd:complexType name="boolean">
    <xsd:simpleContent>
      <xsd:extension base="xsd:boolean">
        <xsd:attributeGroup ref="XFSPcommonMinusEnum"/>
        <xsd:attribute name="calculate" type="boolExpr" use="optional"/>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>
<!--

  number型の定義

  -->
  <xsd:complexType name="number">
    <xsd:simpleContent>
      <xsd:extension base="xsd:decimal">
        <xsd:attributeGroup ref="XFSPcommon"/>
        <xsd:attributeGroup ref="XFSPmmNumber"/>
        <xsd:attributeGroup ref="XFSPspNumber"/>
        <xsd:attributeGroup ref="XFSPcalcAndChoicesNumber"/>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>
<!--

  currency型の定義

-->
  <xsd:complexType name="currency">
    <xsd:simpleContent>
      <xsd:extension base="currencyType">
        <xsd:attributeGroup ref="XFSPcommon"/>
        <xsd:attributeGroup ref="XFSPcalcAndChoicesCurrency"/>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>
<!--

  money型の定義
  選択肢 B: 複合データ型

-->
  <xsd:complexType name="money">
    <xsd:sequence>
      <xsd:element name="value">
        <xsd:complexType>
          <xsd:simpleContent>
            <xsd:extension base="xsd:decimal">
              <xsd:attribute name="calculate" type="numberExpr"/>
            </xsd:extension>
          </xsd:simpleContent>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="currency">
        <xsd:complexType>
          <xsd:simpleContent>
            <xsd:extension base="currencyType">
              <xsd:attribute name="calculate" type="currencyExpr"/>
            </xsd:extension>
          </xsd:simpleContent>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="allowCurrency" type="currencyExpr" minOccurs="0" maxOccurs="unbounded"/>
<!--
      moneyの値空間を制限する任意の数のallowCurrencyエレメント
  -->
    </xsd:sequence>
    <xsd:attributeGroup ref="XFSPcommon"/>
    <xsd:attributeGroup ref="XFSPmmNumber"/>
    <xsd:attributeGroup ref="XFSPspNumber"/>
  </xsd:complexType>
<!--

  date型の定義

  -->
  <xsd:complexType name="date">
    <xsd:simpleContent>
      <xsd:extension base="xsd:date">
        <xsd:attributeGroup ref="XFSPcommon"/>
        <xsd:attributeGroup ref="XFSPmmDate"/>
        <xsd:attributeGroup ref="XFSPcalcAndChoicesDate"/>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>
<!--

  time型の定義

  -->
  <xsd:complexType name="time">
    <xsd:simpleContent>
      <xsd:extension base="xsd:time">
        <xsd:attributeGroup ref="XFSPcommon"/>
        <xsd:attributeGroup ref="XFSPmmTime"/>
        <xsd:attributeGroup ref="XFSPcalcAndChoicesTime"/>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>
<!--

  duration型の定義

  -->
  <xsd:complexType name="duration">
    <xsd:simpleContent>
      <xsd:extension base="xsd:timeDuration">
        <xsd:attributeGroup ref="XFSPcommon"/>
        <xsd:attributeGroup ref="XFSPmmDuration"/>
        <xsd:attributeGroup ref="XFSPcalcAndChoicesDuration"/>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>
<!--
  -->
<!--

  uri型の定義

  -->
  <xsd:complexType name="uri">
    <xsd:simpleContent>
      <xsd:extension base="xsd:uriReference">
        <xsd:attributeGroup ref="XFSPcommon"/>
        <xsd:attributeGroup ref="XFSPlengthNumber"/>
        <xsd:attributeGroup ref="XFSPcalcAndChoicesURI"/>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>
<!--

  binary型の定義

-->
  <xsd:complexType name="binary">
    <xsd:simpleContent>
      <xsd:extension base="xsd:binary">
        <xsd:attributeGroup ref="XFSPcommon"/>
        <xsd:attributeGroup ref="XFSPlengthNumber"/>
        <xsd:attributeGroup ref="XFSPcalcAndChoicesBinary"/>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>
<!--

  XForms simpleシンタックスのエレメント定義
  構造エレメント、データ型エレメントと続く

-->

<!--

  simpleシンタックスエレメントの定義を含むsimpleエレメントの定義

  -->
  <xsd:element name="simple">
    <xsd:complexType>
      <xsd:choice maxOccurs="unbounded">
        <xsd:element ref="string"/>
        <xsd:element ref="boolean"/>
        <xsd:element ref="number"/>
        <xsd:element ref="currency"/>
        <xsd:element ref="money"/>
        <xsd:element ref="date"/>
        <xsd:element ref="time"/>
        <xsd:element ref="duration"/>
        <xsd:element ref="uri"/>
        <xsd:element ref="binary"/>
        <xsd:element ref="element"/>
        <xsd:element ref="array"/>
        <xsd:element ref="group"/>
        <xsd:element ref="switch"/>
        <xsd:element ref="union"/>
      </xsd:choice>
      <xsd:attribute name="id" type="xsd:ID" use="optional"/>
      <xsd:attribute name="name" type="xsd:NCName" use="optional"/>
    </xsd:complexType>
  </xsd:element>
<!--

  simpleシンタックスにおけるgroupエレメントの定義

  -->
  <xsd:element name="group">
    <xsd:complexType>
      <xsd:choice maxOccurs="unbounded">
        <xsd:element ref="string"/>
        <xsd:element ref="boolean"/>
        <xsd:element ref="number"/>
        <xsd:element ref="currency"/>
        <xsd:element ref="money"/>
        <xsd:element ref="date"/>
        <xsd:element ref="time"/>
        <xsd:element ref="duration"/>
        <xsd:element ref="uri"/>
        <xsd:element ref="binary"/>
        <xsd:element ref="element"/>
        <xsd:element ref="switch"/>
        <xsd:element ref="union"/>
      </xsd:choice>
      <xsd:attributeGroup ref="XFSPname"/>
    </xsd:complexType>
  </xsd:element>
  <!--
  arrayで用いられるoccurs属性グループ
  -->
  <xsd:attributeGroup name="occurs">
    <xsd:attribute name="minOccurs" use="default" value="1">
      <xsd:simpleType>
        <xsd:union memberTypes="xfmExpr xsd:nonNegativeInteger"/>
      </xsd:simpleType>
    </xsd:attribute>
    <xsd:attribute name="maxOccurs" use="default" value="1">
      <xsd:simpleType>
        <xsd:union memberTypes="xfmExpr xsd:nonNegativeInteger">
          <xsd:simpleType>
            <xsd:restriction base="xsd:NMTOKEN">
              <xsd:enumeration value="unbounded"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:union>
      </xsd:simpleType>
    </xsd:attribute>
  </xsd:attributeGroup>
<!--

  simpleシンタックスにおけるarrayエレメントの定義
  問題点: switchやunionを許すべきか?

-->
  <xsd:element name="array">
    <xsd:complexType>
      <xsd:choice>
        <xsd:element ref="string"/>
        <xsd:element ref="boolean"/>
        <xsd:element ref="number"/>
        <xsd:element ref="currency"/>
        <xsd:element ref="money"/>
        <xsd:element ref="date"/>
        <xsd:element ref="time"/>
        <xsd:element ref="duration"/>
        <xsd:element ref="uri"/>
        <xsd:element ref="binary"/>
        <xsd:element ref="element"/>
      </xsd:choice>
      <xsd:attribute name="name" type="xsd:NCName" use="optional"/>
      <xsd:attributeGroup ref="occurs"/>
    </xsd:complexType>
  </xsd:element>
<!--

  simpleシンタックスにおけるunionエレメントの定義

  備考: <union> のためのスキーマは、その子データ型にname属性を要求する。
  そのスキーマが、単にそれを定義するために再利用するためである。
  この指定ではnameは子データ型には必須でないとしている。
  これは将来のバージョンで修正される予定の、認識されている不具合である。
 
-->
  <xsd:element name="union">
    <xsd:complexType>
      <xsd:choice maxOccurs="unbounded">
        <xsd:element ref="string"/>
        <xsd:element ref="boolean"/>
        <xsd:element ref="number"/>
        <xsd:element ref="currency"/>
        <xsd:element ref="money"/>
        <xsd:element ref="date"/>
        <xsd:element ref="time"/>
        <xsd:element ref="duration"/>
        <xsd:element ref="uri"/>
        <xsd:element ref="binary"/>
      </xsd:choice>
      <xsd:attributeGroup ref="XFSPname"/>
    </xsd:complexType>
  </xsd:element>
<!--

  simpleシンタックスにおけるswitchエレメントの定義

  -->
  <xsd:element name="switch">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="case" maxOccurs="unbounded">
          <xsd:complexType>
            <xsd:choice maxOccurs="unbounded">
              <xsd:element ref="string"/>
              <xsd:element ref="boolean"/>
              <xsd:element ref="number"/>
              <xsd:element ref="currency"/>
              <xsd:element ref="money"/>
              <xsd:element ref="date"/>
              <xsd:element ref="time"/>
              <xsd:element ref="duration"/>
              <xsd:element ref="uri"/>
              <xsd:element ref="binary"/>
              <xsd:element ref="element"/>
              <xsd:element ref="group"/>
              <xsd:element ref="array"/>
            </xsd:choice>
            <xsd:attributeGroup ref="XFSPname"/>
            <xsd:attribute name="condition" type="xfmExpr" use="optional"/>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
      <xsd:attributeGroup ref="XFSPname"/>
    </xsd:complexType>
  </xsd:element>
<!--

  simpleシンタックスにおけるelementエレメントの定義

  -->
  <xsd:element name="element" id="element">
    <xsd:complexType>
      <xsd:attribute name="type" type="xsd:QName" use="required"/>
      <xsd:attributeGroup ref="XFSPcommonMinusEnumSimple"/>
    </xsd:complexType>
  </xsd:element>
<!--
  simpleシンタックスでのみstringおよびcurrencyに用いられる
  maskファセットの定義。
  WAP/WMLのformat属性をモデルにしている。
  -->
  <xsd:simpleType name="maskType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern 
  value="((A|a|X|x|N|n|M|m)|(\\.))*([0-9\*](A|a|X|x|N|n|M|m))?"/>
    </xsd:restriction>
  </xsd:simpleType>
  <xsd:simpleType name="maskExpr">
    <xsd:union memberTypes="maskType xfmExpr"/>
  </xsd:simpleType>
<!--

  simpleシンタックスにおけるstringエレメントの定義

  -->
  <xsd:element name="string" id="string">
    <xsd:complexType>
      <xsd:simpleContent>
        <xsd:extension base="xsd:string">
          <xsd:attributeGroup ref="XFSPcommonSimple"/>
          <xsd:attributeGroup ref="XFSPlengthNumber"/>
          <xsd:attributeGroup ref="XFSPcalcAndChoicesString"/>
        </xsd:extension>
      </xsd:simpleContent>
    </xsd:complexType>
  </xsd:element>
<!--

  simpleシンタックスにおけるbooleanエレメントの定義

  -->
  <xsd:element name="boolean">
    <xsd:complexType>
      <xsd:simpleContent>
        <xsd:extension base="xsd:boolean">
          <xsd:attributeGroup ref="XFSPcommonMinusEnumSimple"/>
          <xsd:attribute name="calculate" type="boolExpr" use="optional"/>
        </xsd:extension>
      </xsd:simpleContent>
    </xsd:complexType>
  </xsd:element>
<!--

  simpleシンタックスにおけるnumberエレメントの定義

  -->
  <xsd:element name="number">
    <xsd:complexType>
      <xsd:simpleContent>
        <xsd:extension base="xsd:decimal">
          <xsd:attributeGroup ref="XFSPcommonSimple"/>
          <xsd:attributeGroup ref="XFSPmmNumberSimple"/>
          <xsd:attributeGroup ref="XFSPspNumber"/>
          <xsd:attributeGroup ref="XFSPcalcAndChoicesNumber"/>
        </xsd:extension>
      </xsd:simpleContent>
    </xsd:complexType>
  </xsd:element>
<!--
       TBD: maskはcurrencyエレメントで前提として許されているが、currencyエレメントがmoneyの一部である場合にこれを許すべきだろうか?
    -->
  <!--

  simpleシンタックスにおけるcurrencyエレメントの定義

  -->
  <xsd:element name="currency">
    <xsd:complexType>
      <xsd:simpleContent>
        <xsd:extension base="currencyType">
          <xsd:attributeGroup ref="XFSPcommonSimple"/>
          <xsd:attributeGroup ref="XFSPcalcAndChoices"/>
        </xsd:extension>
      </xsd:simpleContent>
    </xsd:complexType>
  </xsd:element>
<!--

  simpleシンタックスにおけるmoneyエレメントの定義
  選択肢 B: 複合データ型

  -->
  <xsd:element name="money">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="value">
          <xsd:complexType>
            <xsd:simpleContent>
              <xsd:extension base="xsd:decimal">
                <xsd:attribute name="calculate" type="numberExpr"/>
              </xsd:extension>
            </xsd:simpleContent>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="currency">
          <xsd:complexType>
            <xsd:simpleContent>
              <xsd:extension base="currencyType">
                <xsd:attribute name="calculate" type="currencyExpr"/>
              </xsd:extension>
            </xsd:simpleContent>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="allowCurrency" type="currencyExpr" minOccurs="0" maxOccurs="unbounded"/>
				<!--
        allow zero or more allowCurrency elements to restrict 
        the value space of money.
  -->
      </xsd:sequence>
      <xsd:attributeGroup ref="XFSPcommonSimple"/>
      <xsd:attributeGroup ref="XFSPmmNumberSimple"/>
      <xsd:attributeGroup ref="XFSPspNumber"/>
    </xsd:complexType>
  </xsd:element>
<!--

  simpleシンタックスにおけるdateエレメントの定義

  -->
  <xsd:element name="date">
    <xsd:complexType>
      <xsd:simpleContent>
        <xsd:extension base="xsd:date">
          <xsd:attributeGroup ref="XFSPcommonSimple"/>
          <xsd:attributeGroup ref="XFSPmmDateSimple"/>
          <xsd:attribute name="precision" use="optional">
            <xsd:simpleType>
              <xsd:restriction base="xsd:NMTOKEN">
                <xsd:enumeration value="years"/>
                <xsd:enumeration value="months"/>
                <xsd:enumeration value="days"/>
              </xsd:restriction>
            </xsd:simpleType>
          </xsd:attribute>
          <xsd:attributeGroup ref="XFSPcalcAndChoicesDate"/>
        </xsd:extension>
      </xsd:simpleContent>
    </xsd:complexType>
  </xsd:element>
<!--

  simpleシンタックスにおけるtimeエレメントの定義

  -->
  <xsd:element name="time">
    <xsd:complexType>
      <xsd:simpleContent>
        <xsd:extension base="xsd:time">
          <xsd:attributeGroup ref="XFSPcommonSimple"/>
          <xsd:attributeGroup ref="XFSPmmTimeSimple"/>
          <xsd:attribute name="precision" use="optional">
            <xsd:simpleType>
              <xsd:restriction base="xsd:NMTOKEN">
                <xsd:enumeration value="hours"/>
                <xsd:enumeration value="minutes"/>
                <xsd:enumeration value="seconds"/>
              </xsd:restriction>
            </xsd:simpleType>
          </xsd:attribute>
          <xsd:attributeGroup ref="XFSPcalcAndChoicesTime"/>
        </xsd:extension>
      </xsd:simpleContent>
    </xsd:complexType>
  </xsd:element>
<!--

  simpleシンタックスにおけるdurationエレメントの定義

  -->
  <xsd:element name="duration">
    <xsd:complexType>
      <xsd:simpleContent>
        <xsd:extension base="xsd:timeDuration">
          <xsd:attributeGroup ref="XFSPcommonSimple"/>
          <xsd:attributeGroup ref="XFSPmmDurationSimple"/>
          <xsd:attribute name="precision" use="optional">
            <xsd:simpleType>
              <xsd:restriction base="xsd:NMTOKEN">
                <xsd:enumeration value="years"/>
                <xsd:enumeration value="months"/>
                <xsd:enumeration value="days"/>
                <xsd:enumeration value="hours"/>
                <xsd:enumeration value="minutes"/>
                <xsd:enumeration value="seconds"/>
              </xsd:restriction>
            </xsd:simpleType>
          </xsd:attribute>
          <xsd:attributeGroup ref="XFSPcalcAndChoicesDuration"/>
        </xsd:extension>
      </xsd:simpleContent>
    </xsd:complexType>
  </xsd:element>
<!--

  simpleシンタックスにおけるuriエレメントの定義

  -->
  <xsd:element name="uri">
    <xsd:complexType>
      <xsd:simpleContent>
        <xsd:extension base="xsd:uriReference">
          <xsd:attributeGroup ref="XFSPcommonSimple"/>
          <xsd:attributeGroup ref="XFSPlengthNumber"/>
          <xsd:attributeGroup ref="XFSPcalcAndChoicesURI"/>
        </xsd:extension>
      </xsd:simpleContent>
    </xsd:complexType>
  </xsd:element>
<!--

  simpleシンタックスにおけるbinaryエレメントの定義

  -->
  <xsd:element name="binary">
    <xsd:complexType>
      <xsd:simpleContent>
        <xsd:extension base="xsd:binary">
          <xsd:attributeGroup ref="XFSPcommonSimple"/>
          <xsd:attributeGroup ref="XFSPlengthNumber"/>
          <xsd:attributeGroup ref="XFSPcalcAndChoicesBinary"/>
        </xsd:extension>
      </xsd:simpleContent>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>