Elemento elenco schema XML
❮ Riferimento completo allo schema XML
Definizione e utilizzo
L'elemento list definisce un elemento di tipo semplice come un elenco di valori di un tipo di dati specificato.
Informazioni sull'elemento
- Elementi principali: simpleType
Sintassi
<list
id=ID
itemType=QName
any attributes
>
(annotation?,(simpleType?))
</list>
(Il segno ? dichiara che l'elemento può essere presente zero o una volta all'interno dell'elemento elenco)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
itemType |
Specifies the name of a built-in data type or simpleType element defined in this or another schema. This attribute is not allowed if the content contains a simpleType element, otherwise it is required |
any attributes | Optional. Specifies any other attributes with non-schema namespace |
Esempio 1
L'esempio seguente mostra un tipo semplice che è un elenco di numeri interi:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="intvalues" type="valuelist"/>
<xs:simpleType name="valuelist">
<xs:list itemType="xs:integer"/>
</xs:simpleType>
</xs:schema>
The "intvalues" element in a document could look like this (notice that
the list will have five list items):
<intvalues>100 34 56 -23 1567</intvalues>
Nota: lo spazio bianco viene considerato come separatore di voci dell'elenco!
Esempio 2
L'esempio seguente mostra un tipo semplice che è un elenco di stringhe:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="stringvalues" type="valuelist"/>
<xs:simpleType name="valuelist">
<xs:list itemType="xs:string"/>
</xs:simpleType>
</xs:schema>
The "stringvalues" element in a document could look like this (notice
that the list will have four list items):
<stringvalues>I love XML Schema</stringvalues>
❮ Riferimento completo allo schema XML