Elemento simpleType del esquema XML
❮ Referencia completa del esquema XML
Definición y uso
El elemento simpleType define un tipo simple y especifica las restricciones y la información sobre los valores de los atributos o elementos de solo texto.
Información del elemento
- Elementos principales: atributo, elemento, lista, restricción, esquema, unión
Sintaxis
<simpleType
id=ID
name=NCName
any attributes
>
(annotation?,(restriction|list|union))
</simpleType>
(El signo ? declara que el elemento puede aparecer cero o una vez dentro del 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 |
Ejemplo 1
Este ejemplo define un elemento llamado "edad" que es un tipo simple con una restricción. El valor de la edad NO puede ser inferior a 0 ni superior a 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>
❮ Referencia completa del esquema XML