15.2.10. XSD empty element

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

Empty compound elements cannot contain content, only attributes.

Compound empty elements:

An empty XML element:

<product prodid="1345" />

The “product” element above has no content at all. In order to define a type without content, we must declare a type that contains only elements in its content, but we do not actually declare any elements, such as this:

<xs:element name="product">
  <xs:complexType>
    <xs:complexContent>
      <xs:restriction base="xs:integer">
        <xs:attribute name="prodid" type="xs:positiveInteger"/>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

In the above example, we define a composite type with composite content. The complexContent element signals that we intend to define or extend the content model of a composite type, while the integer qualification declares an attribute but does not introduce any element content.

However, you can also declare this “product” element more compactly:

<xs:element name="product">
  <xs:complexType>
    <xs:attribute name="prodid" type="xs:positiveInteger"/>
  </xs:complexType>
</xs:element>

Or you can give a name to a complexType element, then set a type attribute for the “product” element and reference the complexType name (by using this method, several elements can refer to the same compound type):

<xs:element name="product" type="prodtype"/>
<xs:complexType name="prodtype">
  <xs:attribute name="prodid" type="xs:positiveInteger"/>
</xs:complexType>
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.