Element XML Schema simpleType
Definicja i Wykorzystanie
Element simpleType określa wartość związaną z informacji i ich prostych typu ograniczeń, regulacji i posiadający zwykły zawartość tekstową elementu lub atrybutu.
Element informacji
- Parent Element: atrybut, element, lista, ograniczenia , schemat, unia
gramatyka
<simpleType
id=ID
name=NCName
any attributes
>
(annotation?,(restriction|list|union))
</simpleType>
id=ID
name=NCName
any attributes
>
(annotation?,(restriction|list|union))
</simpleType>
(? Znak deklaruje, że element może wystąpić zero lub jeden raz w elemencie simpleType).
属性 | 描述 |
---|---|
id | 可选。规定该元素的唯一的 ID。 |
name |
类型名称。 该名称必须是在 XML 命名空间规范中定义的无冒号名称 (NCName)。 如果指定,该名称在所有 simpleType 和 complexType 元素之间必须是唯一的。 如果 simpleType 元素是 schema 元素的子元素,则为必选项,在其他时候则是不允许的。 |
any attributes | 可选。规定带有 non-schema 命名空间的任何其他属性。 |
Przykład 1
W tym przypadku określenie "wiek" elementem jest prosty typ z ograniczeniem. Wartość życia nie może być mniejsza niż 0 lub większy niż 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>
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="100"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
Kompletna XML Schema Reference