With XML Schema, one element can be replaced by another. Let’s give an example: our users are from the UK and Norway. We want to be able to give users the ability to choose whether to use Norwegian or English element names in XML documents. To solve this problem, we can define a substitutionGroup . First, we declare the primary element, and then we declare the secondary elements, which can declare that they can replace the primary element. In the above example, the “name” element is the main element, while the “navn” element replaces the “name” element. Take a look at a clip of XML schema: A valid XML document looks like this (according to the schema above): Or something like this: To prevent other elements from replacing a specified element, use the block attribute: Take a look at a clip of a XML schema: A legitimate XML document should look like this (according to the schema above): But the following documents are no longer legal: The type of the replaceable element must be the same as or derived from the parent element. If the type of the replaceable element is the same as the type of the main element, you do not have to specify the type of the replaceable element. Note that all elements in the substitutionGroup (primary and replaceable elements) must be declared as global elements or they will not work! The global element refers to the immediate child element of the “schema” element! Local elements (Local elements) refer to elements that are nested within other elements.
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. Element substitution ¶
<xs:element name="name" type="xs:string"/>
<xs:element name="navn" substitutionGroup="name"/>
<xs:element name="name" type="xs:string"/>
<xs:element name="navn" substitutionGroup="name"/>
<xs:complexType name="custinfo">
<xs:sequence>
<xs:element ref="name"/>
xs:sequence>
xs:complexType>
<xs:element name="customer" type="custinfo"/>
<xs:element name="kunde" substitutionGroup="customer"/>
<customer>
<name>John Smithname>
customer>
<kunde>
<navn>John Smithnavn>
kunde>
Prevent element substitution ¶
<xs:element name="name" type="xs:string" block="substitution"/>
<xs:element name="name" type="xs:string" block="substitution"/>
<xs:element name="navn" substitutionGroup="name"/>
<xs:complexType name="custinfo">
<xs:sequence>
<xs:element ref="name"/>
xs:sequence>
xs:complexType>
<xs:element name="customer" type="custinfo" block="substitution"/>
<xs:element name="kunde" substitutionGroup="customer"/>
<customer>
<name>John Smithname>
customer>
<kunde>
<navn>John Smithnavn>
kunde>
Use substitutionGroup ¶
What is a global element (Global Elements)? ¶
Principles, Technologies, and Methods of Geographic Information Systems
102