Element SimpleType schématu XML
❮ Vyplňte odkaz na schéma XML
Definice a použití
Element simpleType definuje jednoduchý typ a určuje omezení a informace o hodnotách atributů nebo pouze textových prvků.
Informace o prvku
- Nadřazené prvky: atribut, prvek, seznam, omezení, schéma, sjednocení
Syntax
<simpleType
id=ID
name=NCName
any attributes
>
(annotation?,(restriction|list|union))
</simpleType>
(Znak ? deklaruje, že prvek se může v prvku simpleType vyskytnout nula nebo jednou)
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 |
Příklad 1
Tento příklad definuje prvek nazvaný „věk“, který je jednoduchého typu s omezením. Hodnota věku NEMŮŽE být nižší než 0 nebo vyšší než 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>
❮ Vyplňte odkaz na schéma XML