Missing functionality in the current XML schema standard (type inheritance)

Hello,

we use XML schema to describe object graphs in Java.
The schema describes the classes of objects in the graph (their data fields).

Our aim is to represent the graph using an XML file.
Such an XML file can be later used to configure objects.
The schema allows us to validate the content of the configuration file.

(1)
Since we are trying to map Java-types to XML schema types, we have
problems with multiple inheritance (Java interfaces) which is not supported
in the current XML schema specification.
We would really appreciate if the XSD standard supported multiple inheritance.

(2)
The second problem is related to the order of elements.
Basically, the order of fields in a class is not important.
For our purposes, the "xs:all" seems to be more appropriate 
than the "xs:sequence" element.

The problem is that in XML schemas only types with "xs:sequence" can be inherited 
from.

Example:

Insteda of the following definitions:

<xs:complexType name="Person"> 
    <xs:sequence> 
        <xs:element name="firstName" type="xs:string" minOccurs="0" maxOccurs="1"/>
        <xs:element name="middleName" type="xs:string" minOccurs="0" maxOccurs="1"/>
        <xs:element name="lastName" type="xs:string" minOccurs="0" maxOccurs="1"/>
    </xs:sequence> 
</xs:complexType> 
    
<xs:complexType name="XPerson">
    <xs:complexContent>
        <xs:extension base="Person">
            <xs:sequence>
                <xs:element name="age" type="xs:string" minOccurs="0" maxOccurs="1"/>
                <xs:element name="sex" type="xs:string" minOccurs="0" maxOccurs="1"/>
                <xs:element name="maritalStatus" type="xs:string" minOccurs="0" maxOccurs="1"/>
            </xs:sequence>
        </xs:extension>
    </xs:complexContent>
</xs:complexType> 

We would need something like this (which is not allowed at the time).
The "xs:sequence" are replaced by "xs:all".

<xs:complexType name="Person"> 
    <xs:all> 
        <xs:element name="firstName" type="xs:string" minOccurs="0" maxOccurs="1"/>
        <xs:element name="middleName" type="xs:string" minOccurs="0" maxOccurs="1"/>
        <xs:element name="lastName" type="xs:string" minOccurs="0" maxOccurs="1"/>
    </xs:all> 
</xs:complexType> 
    
<xs:complexType name="XPerson">
    <xs:complexContent>
        <xs:extension base="Person">
            <xs:all>
                <xs:element name="age" type="xs:string" minOccurs="0" maxOccurs="1"/>
                <xs:element name="sex" type="xs:string" minOccurs="0" maxOccurs="1"/>
                <xs:element name="maritalStatus" type="xs:string" minOccurs="0" maxOccurs="1"/>
            </xs:all>
        </xs:extension>
    </xs:complexContent>
</xs:complexType> 

----------

With best regards

Michal Palicka
Cleverlance
Czech Republic

Received on Wednesday, 7 December 2005 21:49:45 UTC