XML Schema 参考手册 完整 XML Schema 参考手册 The attribute element defines an attribute. 父元素: AttributeGroup, schema, complexType, restriction (both simpleContent and complexContent), extension (both simpleContent and complexContent) (? The symbol declares that the element can appear zero or once in the attribute element. ) Attribute Description Default Optional. Specifies the default value for the property. The default and fixed properties cannot appear at the same time. Fixed Optional. Specifies the fixed value of the attribute. The default and fixed properties cannot appear at the same time. Form Optional. Specifies the format of the attribute. The default value is the value of the attributeFormDefault attribute of the schema element that contains the attribute. Can be set to the following values: “qualified”-indicates that this attribute must be qualified by the namespace prefix and the non-colon name (NCName) of the attribute. “unqualified”-indicates that this property does not need to be qualified by a namespace prefix and does not need to match the non-colon name (NCName), the local name, of this attribute. Id Optional. Specifies the unique ID of the element. Name Optional. Specifies the name of the attribute. The name and ref properties cannot appear at the same time. Ref Optional. Specifies a reference to the specified property. The name and ref properties cannot appear at the same time. If ref appears, the simpleType element, form, and type cannot appear. Type Optional. Specify built-in data types or simple types. The type attribute can only appear if the content does not contain a simpleType element. Use Optional. Specifies how to use this property. The following values can be set: Optional-the attribute is optional and can have any value (default). Prohibited-attributes cannot be used. Required-required for the attribute. Any attributes Optional. Specifies any other attributes with the non-schema namespace. The above example indicates that the “code” property has a qualification. The only acceptable values are the two letters in the uppercase letters A to Z. To declare a property using an existing property definition in a complex type, use the ref property: Property can have either a default value or a specified fixed value. When no other value is specified, the default value is automatically assigned to the property. In the following example, the default value is “EN”: When no other value is specified, a fixed value is automatically assigned to the property. However, unlike the default value, if you specify a value other than a fixed value for the property, the document is validated as invalid. In the following example, the fixed value is “EN”: All properties are optional by default. To explicitly specify that the property is optional, use the “use” attribute: To make an attribute a required attribute:
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. Definition and usage ¶
Element information ¶
Grammar ¶
Example 1 ¶
<xs:attribute name="code">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z][A-Z]"/>
xs:restriction>
xs:simpleType>
xs:attribute>
Example 2 ¶
<xs:attribute name="code">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z][A-Z]"/>
xs:restriction>
xs:simpleType>
xs:attribute>
<xs:complexType name="someComplexType">
<xs:attribute ref="code"/>
xs:complexType>
Example 3 ¶
<xs:attribute name="lang" type="xs:string" default="EN"/>
<xs:attribute name="lang" type="xs:string" fixed="EN"/>
Example 4 ¶
<xs:attribute name="lang" type="xs:string" use="optional"/>
<xs:attribute name="lang" type="xs:string" use="required"/>
Principles, Technologies, and Methods of Geographic Information Systems
102