Elemento sequenza XML Schema
❮ Riferimento completo allo schema XML
Definizione e utilizzo
L'elemento sequenza specifica che gli elementi figlio devono apparire in una sequenza. Ogni elemento figlio può verificarsi da 0 a qualsiasi numero di volte.
Informazioni sull'elemento
- Elementi principali: gruppo, scelta, sequenza, complexType, restrizione (sia simpleContent che complexContent), estensione (sia simpleContent che complexContent)
Sintassi
<sequence
id=ID
maxOccurs=nonNegativeInteger|unbounded
minOccurs=nonNegativeInteger
any attributes
>
(annotation?,(element|group|choice|sequence|any)*)
</sequence>
(Il segno ? dichiara che l'elemento può verificarsi zero o una volta all'interno dell'elemento della sequenza)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
maxOccurs | Optional. Specifies the maximum number of times the sequence element can occur in the parent element. The value can be any number >= 0, or if you want to set no limit on the maximum number, use the value "unbounded". Default value is 1 |
minOccurs | Optional. Specifies the minimum number of times the sequence element can occur in the parent element. The value can be any number >= 0. Default value is 1 |
any attributes | Optional. Specifies any other attributes with non-schema namespace |
Esempio 1
Questo esempio mostra una dichiarazione per un elemento chiamato "personinfo", che deve contenere i seguenti cinque elementi in ordine; "nome", "cognome", "indirizzo", "città" e "paese":
<xs:element name="personinfo">
<xs:complexType>
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
<xs:element name="address" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
<xs:element name="country" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Esempio 2
Questo esempio mostra una dichiarazione per un elemento chiamato "pets" che può avere zero o più dei seguenti elementi, cane e gatto, nell'elemento sequenza:
<xs:element name="pets">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="dog" type="xs:string"/>
<xs:element name="cat" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
❮ Riferimento completo allo schema XML