Element simpleType schematu XML
❮ Pełne odniesienie do schematu XML
Definicja i użycie
Element simpleType definiuje typ prosty i określa ograniczenia oraz informacje o wartościach atrybutów lub elementów tekstowych.
Informacje o elemencie
- Elementy nadrzędne: atrybut, element, lista, ograniczenie, schemat, unia
Składnia
<simpleType
id=ID
name=NCName
any attributes
>
(annotation?,(restriction|list|union))
</simpleType>
(Znak ? deklaruje, że element może wystąpić zero lub jeden raz wewnątrz elementu simpleType)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
name | Specifies a name for the element. This attribute is required if the simpleType element is a child of the schema element, otherwise it is not allowed |
any attributes | Optional. Specifies any other attributes with non-schema namespace |
Przykład 1
Ten przykład definiuje element o nazwie „age”, który jest prostym typem z ograniczeniem. Wartość wieku NIE może być mniejsza niż 0 ani większa 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>
❮ Pełne odniesienie do schematu XML