<xsd:list> ElementÂ
Defines a collection of a single simpleType definition.
<list
id = ID
itemType = QName
{any attributes with non-schema Namespace}...>
Content: (annotation?, (simpleType?))
</list>
Attributes
id
The ID of this element. The id value must be of type ID and be unique within the document containing this element.Optional.
itemType
The name of a built-in data type or simpleType element defined in this schema (or another schema indicated by the specified namespace). The simpleType element containing the list element is derived from the simple type specified by the list value. The list value must be a qualified name (QName). The use of the simpleType element child and the itemType attribute is mutually exclusive.Not allowed if the content contains a simpleType element. Otherwise, required.
Element Information
Number of occurrences |
One time |
Parent elements |
|
Child elements |
Remarks
When a data type is derived from a list data type, the following constraining facets can be used.
length
maxLength
minLength
Enumeration
Pattern
whiteSpace
The unit of length is measured in the number of list items. For example, the following example sets the maxLength to 5
, limiting the number of items in an instance of the derivedlistOfIntegers data type to 5 items in this list. Note that restrictions in a list are distinct from restrictions used in other elements.
Lists are always delimited by white space. For example, deriving a list from a simple type of three enumerations such as "books" "magazine articles" "technical newspapers and business journals"
generates a list of eight strings: "books", "magazine", "articles", "technical", "newspapers", "and", "business", "journals"
not a list of three strings.
Example
The following example shows a simpleType that is a list of integers where 5 is the maximum number of items allowed in the list.
<xs:simpleType name='derivedlistOfIntegers'>
<xs:restriction base='listOfIntegers'>
<xs:maxLength value='5'>
</xs:restriction>
</xs:simpleType>
Example
The following example shows a simpleType that is a list of integers.
<xs:simpleType name='listOfIntegers'>
<xs:list itemType='integer'/>
</xs:simpleType>
Example
The following example shows an instance of an element that has an attribute of type listOfIntegers. Each item in the list is of type integer and is separated by white space — in this case, a space.
<myelement listOfIntegers='1 100 9 4000 0'/>
Other Resources
For more information see the W3C XML Schema Part 1: Structures Recommendation at www.w3.org/TR/2001/REC-xmlschema-1-20010502\#element-all.