[Home] [By Thread] [By Date] [Recent Entries]

  • From: Mukul Gandhi <mukulg@s...>
  • To: Roger L Costello <costello@m...>
  • Date: Tue, 22 Feb 2022 13:35:01 +0530

On Mon, Feb 21, 2022 at 10:57 PM Roger L Costello <costello@m...> 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


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member