15.2.35. XML Schema complexType element

发布时间 :2025-10-25 12:23:28 UTC      

XML Schema 参考手册 完整 XML Schema 参考手册

Definition and usage

The complexType element defines a complex type. Elements of complex types are XML elements that contain other elements and / or attributes.

Element information

  • 父元素: Element, redefine, schema

Grammar

<complexType
id=ID
name=NCName
abstract=true|false
mixed=true|false
block=(#all|list of (extension|restriction))
final=(#all|list of (extension|restriction))
*any attributes*
>
(annotation?,(simpleContent|complexContent|((group|all\|
choice|sequence)?,((attribute|attributeGroup)*,anyAttribute?))))
</complexType>

(? Symbol declaration in the complexType element, the element can appear zero or once, and the* symbol declares that the element can appear zero or more times. )

Attribute

Description

Id

Optional. Specifies the unique ID of the element.

Name

Optional. Specifies the name of the element.

Abstract

Optional. Specifies whether complex types can be used in the instance document. If the value is true, the element cannot use the complex type directly, but must use the complex type derived from the complex type. The default is false.

Mixed

Optional. Specifies whether character data is allowed to appear between child elements of this complex type. The default is false.

  • If the simpleContent element is a child element, the mixed attribute is not allowed.

  • If the complexContent element is a child element, the mixed attribute can be overridden by the mixed attribute of the complexContent element.

Block

Optional. Prevents a complex type with a specified derived type from being used to replace that complex type. The value can contain # all or a list that is a subset of extension or restriction:

  • Extension-prevents a complex type derived from an extension from being used to replace that complex type.

  • Restriction-prevents a complex type derived by restriction from being used to replace that complex type.

  • # all-prevents all derived complex types from being used to replace that complex type.

Final

Optional. Prevents the specified type from being derived from this complexType element. The value can contain # all or a list that is a subset of extension or restriction.

  • Extension-prevents derivation by extension.

  • Restriction-prevents derivation by restriction.

  • # all-prevents all derivations (extensions and restrictions).

Any attributes

Optional. Specifies any other attributes with the non-schema namespace.

Example 1

The following example has a complex type element named “note”:

<xs:element name="note">
  <xs:complexType>
    <xs:sequence>
  <xs:element name="to" type="xs:string"/>
  <xs:element name="from" type="xs:string"/>
  <xs:element name="heading" type="xs:string"/>
  <xs:element name="body" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

Example 2

In the following example, there is a complex type “fullpersoninfo” that extends the inherited type by using three supplementary elements (address, city, and country), derived from another complex type “personinfo”:

<xs:element name="employee" type="fullpersoninfo"/>
<xs:complexType name="personinfo">
  <xs:sequence>
    <xs:element name="firstname" type="xs:string"/>
    <xs:element name="lastname" type="xs:string"/>
  </xs:sequence>
</xs:complexType>
<xs:complexType name="fullpersoninfo">
  <xs:complexContent>
    <xs:extension base="personinfo">
      <xs:sequence>
        <xs:element name="address" type="xs:string"/>
        <xs:element name="city" type="xs:string"/>
        <xs:element name="country" type="xs:string"/>
      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

In the above example, the “employee” element above must contain the following elements in order: “firstname”, “lastname”, “address”, “city”, and “country”.

XML Schema 参考手册 完整 XML Schema 参考手册

Principles, Technologies, and Methods of Geographic Information Systems  102

In recent years, Geographic Information Systems (GIS) have undergone rapid development in both theoretical and practical dimensions. GIS has been widely applied for modeling and decision-making support across various fields such as urban management, regional planning, and environmental remediation, establishing geographic information as a vital component of the information era. The introduction of the “Digital Earth” concept has further accelerated the advancement of GIS, which serves as its technical foundation. Concurrently, scholars have been dedicated to theoretical research in areas like spatial cognition, spatial data uncertainty, and the formalization of spatial relationships. This reflects the dual nature of GIS as both an applied technology and an academic discipline, with the two aspects forming a mutually reinforcing cycle of progress.