In addition to using the atomic types described in the simple type (these atomic types can be used to combine most other types, including other simple types and composite types), XML Schema has list types in the simple type category (List Type) )the concept of. Atomic types, list types, and joint types are always called simple types. The value of an atom type is intended in XML Schema. For example, the NMTOKEN value US is indivisible, any part of US, such as the letter S itself is meaningless. Compared with it, the list type is composed of a set of atomic types, so every part of it (atom) itself is meaningful. For example, NMToKens is a list of lists. This type of element will be NMTOKEN's list, and different NMToken values are separated by spaces, such as "US UK FR". XML Schema has three built-in lists, which are NMTOKENS, IDREFS, and Entities.
In addition to using the built-in list type, you can create new list types by reference to existing atomic types (you cannot use existing list types to create new list types, and you cannot use composite types to create new list types. ). For example, we can build a list type named Myinteger and use it in the instance document (see Code 10). The second half of the code 10 is an example element consistent with the list type listofmyintType in the instance document.
xsd: SimpleType>
Some parameters used to describe can be applied to the definition of list types, which are Length, MINLENGTH, MAXLENGTH, and ENUMERATION. For example, if we want to define a list, this list just contains six US states (SixusStates). First define a new list type from usState, called UsstateList, and then export SixusStates by limiting usStateList. Specific definitions can be found in code 11.
xsd: SimpleType>
xsd: restriction>
xsd: SimpleType>
Elements of type SixusStates must have six items, and each item in them must be an atomic type of an enumeration type USState, which is a specific application example in an instance document in the second half of the code 11. What we need to note is that from the atomic type string can export a list type, however, in a string may have spaces, and spaces are used as separators in a list type instance. Therefore, when using the list type of the base type for String, it should be extra care. For example, suppose we define a list type of Length with a value of 3, and this list is based on the type String. The following is a list of three elements is legal: "asie europe afrique"; and the list of three elements is illegal: "Asie Europe amérique latine". Even "Amérique Latine" can be existing as a separate string outside of the list, but when it is included in the list, space between amérique and latine makes the fourth item are effectively generated, so the example behind it is not Compliance with only three list types definitions are defined.
Joint type
Applying atomic types and list types, a value of an element or attribute can be an instance of one or more atom types (list types). In contrast, an application co-type contains multiple atomic types or list types, and the value of the federal type or attribute can be a type instance in these atomic types or list types. In order to show this, we build a joint type for expressing two alphanukens or digital lists for the United States. The zipunion combined type consists of an atom type and a list type (see Code 12).
xsd: SimpleType>
When we define a federated type, the value of the Membertypes property of the element Union contains all types of types in the federated type. Now, we have declare an element of zipunion type, called zips, and ZIPS elements. Examples can be found in code 12.
In addition, for the federated type, there are two parameters of the nature of the description, and Enumeration can also be used.