XSD Elements Only

A complex type element containing an element that contains only other elements is called an “elements-only” complex type.

Complex Types Containing Elements Only:

Example 1:


  Tom
  Davis

Explanation:

In the above example, the XML element “student”, contains other elements only.

Example 2:


  
    
      
      
    
  

Explanation:

In the above example, we are defining the “student” element in a schema. To indicate that the elements defined (“firstname” and “lastname”) must appear in that order inside a “student” element, we are using the <xs:sequence> tag.

Example 3:




  
    
    
  

Explanation:

In the above example, we are providing a name to the complexType element. The “student” element is thus allowed to have a type attribute that refers to the name of the complexType. Several elements can refer to the same complex type, by using this method.

Please follow and like us:
Content Protection by DMCA.com