XSD Complex Empty Elements:In your XSD schema, you can define empty XSD complex element with no content.
xml code
<xs:element name="student">
<xs:complexType>
<xs:complexContent>
<xs:restriction base="xs:integer">
<xs:attribute name="GPA" type="xs:positiveInteger"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>
This XSD snippet defines an XML element called "student" with a complex type consisting of an integer data type restriction. The restriction has an attribute called "GPA" of the data type "xs:positiveInteger". This means that the "student" element must contain an integer value, and it can also have an attribute called "GPA" that must contain a positive integer value. It is worth noting that this XSD snippet only defines the structure of the "student" element, it doesn't specify any rules or constraints on how many times the element can occur, where it can occur in the XML document, or what elements can come before or after it. If you want to specify these kinds of rules, you would need to include the "student" element in a larger XSD schema that defines the overall structure of the XML document. You can also specify the default value and fixed values for the attribute "GPA" by using the default and fixed attributes in the xs:attribute element.
The above Complex element type doesn't have any content elements.
xml code
<xs:element name="student">
<xs:complexType>
<xs:attribute name="GPA" type="xs:positiveInteger"/>
</xs:complexType>
</xs:element>
XML example:
xml code
<student GPA=3 />
Also remember, you can also can define you type by reference to complex type.
xml code
<xs:element name="student" type="studentType" />
<xs:complexType name="studentType" >
<xs:attribute name="GPA" type="xs:positiveInteger"/>
</xs:complexType>