There are two ways to define an object type in the schema:
•Declare an element with a complex type
•Declare a complex type used to derive the type of element.
Declare an element with complexType
The example below uses an element to declare an object type ‘test’, derived from the object type ‘object’ and with an additional attribute ‘location’.
<xs:element name="test">
<xs:complexType>
<xs:complexContent>
<xs:extension base="object">
<xs:attribute
name="location"
type="xs:string"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
Declare a complexType used to derive the type of element
An alternative way to define an object type is to declare a complex type that will be used to derive the type of elements. The following example declares an object type ‘object’ with the attributes ‘id’ and ‘name’.
<xs:complexType name="object">
<xs:attribute name="id" type="xs:ID" />
<xs:attribute name="name" type="tName" />
</xs:complexType>
IMPORTANT: All the object types declared in this way are abstract – i.e., you can't use them to create objects, but only for attribute inheritance.