最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

XML Schema restriction 元素

定義和用法

restriction 元素定義對(duì) simpleType、simpleContent 或 complexContent 定義的約束。

元素信息

出現(xiàn)次數(shù) 一次
父元素 complexContent
內(nèi)容 group、all、choice、sequence、attribute、attributeGroup、anyAttribute

語(yǔ)法

<restriction
id=ID
base=QName
any attributes
>

Content for simpleType:
(annotation?,(simpleType?,(minExclusive|minInclusive| 
maxExclusive|maxInclusive|totalDigits|fractionDigits|
length|minLength|maxLength|enumeration|whiteSpace|pattern)*))

Content for simpleContent:
(annotation?,(simpleType?,(minExclusive |minInclusive| 
maxExclusive|maxInclusive|totalDigits|fractionDigits|
length|minLength|maxLength|enumeration|whiteSpace|pattern)*)?, 
((attribute|attributeGroup)*,anyAttribute?))

Content for complexContent:
(annotation?,(group|all|choice|sequence)?,
((attribute|attributeGroup)*,anyAttribute?))

</restriction>

(? 符號(hào)聲明在 restriction 元素中該元素可出現(xiàn)零次或一次。)

屬性 描述
id 可選。規(guī)定該元素的唯一的 ID。
base 必需。規(guī)定在該 schema(或由指定的命名空間指示的其他 schema)中定義的內(nèi)建數(shù)據(jù)類型、simpleType 或 complexType 元素的名稱。
any attributes 可選。規(guī)定帶有 non-schema 命名空間的任何其他屬性。

實(shí)例

例子 1

下面的例子定義了一個(gè)帶有約束且名為 "age" 的元素。age 的值不能小于 0 或大于 100:

<xs:element name="age">
  <xs:simpleType>
    <xs:restriction base="xs:integer">
      <xs:minInclusive value="0"/>
      <xs:maxInclusive value="100"/>
    </xs:restriction>
  </xs:simpleType>
</xs:element>

例子 2

本例定義了一個(gè)名為 "initials" 的元素。"initials" 元素是帶有約束的簡(jiǎn)單類型?山邮艿闹凳侨齻(gè)從 a 到 z 的大寫或小寫字母:

<xs:element name="initials">
  <xs:simpleType>
    <xs:restriction base="xs:string">
      <xs:pattern value="[a-zA-Z][a-zA-Z][a-zA-Z]"/>
    </xs:restriction>
  </xs:simpleType>
</xs:element> 

例子 3

本例定義了一個(gè)名為 "password" 元素。"password" 元素是帶有約束的簡(jiǎn)單類型。值必須為最少 5 個(gè)字符且最多 8 個(gè)字符:

<xs:element name="password">
  <xs:simpleType>
    <xs:restriction base="xs:string">
      <xs:minLength value="5"/>
      <xs:maxLength value="8"/>
    </xs:restriction>
  </xs:simpleType>
</xs:element>

例子 4

本例展示了一個(gè)使用約束的復(fù)雜類型定義。復(fù)雜類型 "Chinese_customer" 從一個(gè)普通的 customer 復(fù)雜類型派生而來(lái),其 country 元素的固定值是 "China":

<xs:complexType name="customer">
  <xs:sequence>
    <xs:element name="firstname" type="xs:string"/>
    <xs:element name="lastname" type="xs:string"/>
    <xs:element name="country" type="xs:string"/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="Chinese_customer">
  <xs:complexContent>
    <xs:restriction base="customer">
      <xs:sequence>
        <xs:element name="firstname" type="xs:string"/>
        <xs:element name="lastname" type="xs:string"/>
        <xs:element name="country" type="xs:string" fixed="China"/>
      </xs:sequence>
    </xs:restriction>
  </xs:complexContent>
</xs:complexType>
桐庐县| 远安县| 都江堰市| 溧水县| 藁城市| 博罗县| 丘北县| 河东区| 兴隆县| 通河县| 黑河市| 延安市| 大英县| 德惠市| 泾源县| 芜湖县| 长宁区| 怀安县| 静宁县| 石棉县| 科技| 墨脱县| 宝丰县| 武清区| 那坡县| 乐亭县| 宜阳县| 双柏县| 敦化市| 隆子县| 宁蒗| 井冈山市| 八宿县| 天柱县| 辽阳市| 长宁县| 香格里拉县| 菏泽市| 凯里市| 五原县| 芜湖县|