Elemento XML Schema simpleType
❮ Riferimento completo allo schema XML
Definizione e utilizzo
L'elemento simpleType definisce un tipo semplice e specifica i vincoli e le informazioni sui valori degli attributi o degli elementi di solo testo.
Informazioni sull'elemento
- Elementi principali: attributo, elemento, elenco, restrizione, schema, unione
Sintassi
<simpleType
id=ID
name=NCName
any attributes
>
(annotation?,(restriction|list|union))
</simpleType>
(Il segno ? dichiara che l'elemento può verificarsi zero o una volta all'interno dell'elemento 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 |
Esempio 1
Questo esempio definisce un elemento chiamato "età" che è un tipo semplice con una restrizione. Il valore dell'età NON può essere inferiore a 0 o maggiore di 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>
❮ Riferimento completo allo schema XML