15.2.15. XSD < any > element

发布时间 : 2025-10-25 13:35:24 UTC      

Page Views: 38 views

The < any > element gives us the ability to expand XML documents through elements that are not specified by schema!

< any > element

The < any > element gives us the ability to expand XML documents through elements that are not specified by schema!

The following example is a snippet referenced from a XML schema named “family.xsd”. It shows a declaration for the “person” element. By using the < any > element, we can extend the content of “person” with any element (after < lastname >):

<xs:element name="person">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="firstname" type="xs:string"/>
      <xs:element name="lastname" type="xs:string"/>
      <xs:any minOccurs="0"/>
    xs:sequence>
  xs:complexType>
xs:element>
   

Now we want to use the “children” element to extend the “person” element. We can do this in this case, even if the author of the above schema does not declare any “children” elements.

Please look at this schema file, named “children.xsd”:




  
    
      
    
  


   

The following XML file (named “Myfamily.xml”) uses components from two different schema, “family.xsd” and “children.xsd”:




  Hege
  Refsnes
  
    Cecilie
  


  Stale
  Refsnes


The above XML file is valid because the schema “family.xsd” allows us to extend the “person” element with an optional element after the “lastname” element.

Both < any > and < anyAttribute > can be used to make extensible documents! They give the document the ability to contain additional elements that are not declared in the main 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.