Suppose i have got schema
<xs:complexType name="superType">
<xs:sequence>
<xs:element type="s:itemType" name="item" maxOccurs="unbounded" minOccurs="1">
</xs:element>
</xs:sequence>
<xs:attribute type="s:stringNameType" name="name" use="required"/>
<xs:attribute type="s:extraType" name="extra" use="optional" default="ALL"/>
</xs:complexType>
and my next element:
<xs:complexType name="elegantType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="s:stringNameType" name="name" use="required"/>
<xs:attribute type="s:extraType" name="extra" use="optional" default="ALL"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
As you can see elegantType and superType have got the same attribute :
<xs:attribute type="s:stringNameType" name="name" use="required"/>
<xs:attribute type="s:extraType" name="extra" use="optional" default="ALL"/>
Its possible to create base type for that element using extension?
I try define base type but i have got error : The content type of a derived type and that of its base must both be mixed or both be element-only. Type 'superType' is element only, but its base type is not.
This is what i try to do :
<xs:element type="s:itemType" name="item" maxOccurs="unbounded" minOccurs="1">
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
<!-- <xs:attribute type="s:stringNameType" name="name" use="required"/>
<xs:attribute type="s:extraType" name="extra" use="optional" default="ALL"/>-->
</xs:complexType>
<xs:complexType name="resourceBase" mixed="true">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="s:stringNameType" name="name" use="required"/>
<xs:attribute type="s:extraType" name="extra" use="optional" default="ALL"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
My problem is that i have got many element and most of them have got the same attribute. And i need create base element