15.2.6. XSD simple element

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

XML Schema defines the elements of the XML file.

Simple elements are those that contain only text. It does not contain any other elements or attributes.

What are simple elements?

Simple elements are those that contain only text. It does not contain any other elements or attributes.

However, the limitation of “text only” can easily be misunderstood. There are many types of text. It can be one of the types included in the XML Schema definition (Boolean, string, data, etc.), or it can be a custom type that you define yourself.

You can also limit its content by adding qualifications (that is, facets) to the data type, or you can require the data to match a particular schema.

Define simple elements

Define the syntax for simple elements:

<xs:element name="xxx" type="yyy"/>

Here xxx refers to the name of the element, and yyy refers to the data type of the element. XML Schema has many built-in data types.

The most common types are:

  • Xs:string

  • Xs:decimal

  • Xs:integer

  • Xs:boolean

  • Xs:date

  • Xs:time

Example

Here are some XML elements:

<lastname>Refsnes</lastname>
<age>36</age>
<dateborn>1970-03-27</dateborn>

This is the corresponding simple element definition:

<xs:element name="lastname" type="xs:string"/>
<xs:element name="age" type="xs:integer"/>
<xs:element name="dateborn" type="xs:date"/>

Default values and fixed values for simple elements

Simple elements can have specified default values or fixed values.

When no other value is specified, the default value is automatically assigned to the element.

In the following example, the default value is “red”:

<xs:element name="color" type="xs:string" default="red"/>

A fixed value is also automatically assigned to the element, and you cannot specify another value.

In the following example, the fixed value is “red”:

<xs:element name="color" type="xs:string" fixed="red"/>

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.