Next in thread → Next in month →

Re: [xml-dev] Can every Salami Slice schema can be converted to an equivalent Russian Doll schema?

From
Mukul Gandhi <>
To
Roger L Costello <>
Date
2022-02-22T08:05:01Z
ID
<CANGHzgD1y3nF4G25bmPuyHEeiLav2xPZEYg_=>
Thread
Re: [xml-dev] Can every Salami Slice schema can be converted to an equivalent Russian Doll schema?
On Mon, Feb 21, 2022 at 10:57 PM Roger L Costello <[email protected]> wrote:

Here’s why: XML Schema does not allow an element to hold two child elements with the same name unless the child elements can be determined to have the same type. A human can visually look at the Russian Doll schema and see that the two A elements have the same type:

<xs:simpleType>
    <xs:restriction base="xs:string">
        <xs:enumeration value="A"/>
    </xs:restriction>
</xs:simpleType>

 


Although, the lexical schema type definition,

<xs:simpleType>
    <xs:restriction base="xs:string">
        <xs:enumeration value="A"/>
    </xs:restriction>
</xs:simpleType>

appearing at two different places, look to be equivalent type definitions, I think an XSD processor shouldn't be attempting to determine this XSD type equality (in a general case, it'd be very hard to determine XSD type equality by comparing in-memory XSD type component definitions).

Consider, the following XSD 1.1 type definitions,

<xs:simpleType>
    <xs:restriction base="xs:string">
        <xs:assertion test="$value = 'A'"/>
    </xs:restriction>
</xs:simpleType>

<xs:simpleType>
    <xs:restriction base="xs:string">
         <xs:assertion test="$value = 'B'"/>
    </xs:restriction>
</xs:simpleType>

Its nearly impractical, to determine whether such type definitions are equal.

 
--
Regards,
Mukul Gandhi
Next in thread → Next in month →