Elemento simpleType do esquema XML
❮ Referência Completa do Esquema XML
Definição e uso
O elemento simpleType define um tipo simples e especifica as restrições e informações sobre os valores de atributos ou elementos somente texto.
Informações do elemento
- Elementos pai: atributo, elemento, lista, restrição, esquema, união
Sintaxe
<simpleType
id=ID
name=NCName
any attributes
>
(annotation?,(restriction|list|union))
</simpleType>
(O sinal ? declara que o elemento pode ocorrer zero ou uma vez dentro do 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 |
Exemplo 1
Este exemplo define um elemento chamado "age" que é um tipo simples com uma restrição. O valor da idade NÃO pode ser inferior a 0 ou 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>
❮ Referência Completa do Esquema XML