OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Complex type inheritance is evil!



"Anderson, John" wrote:
 Yep, I'd played around with that and it solved the problem. However, as I posted on the W3C list to HT's answer, it leaves a very clear inconsistency:
What list did HT answer to? I find this problem with restriction a bit strange and I'd like to follow up on the information but I haven't seen a answer from HT on the list. Can you please point me to that reply?
If I try restricting the following:

<xsd:complexType name="Items">
  <xsd:sequence>
   <xsd:element name="item" minOccurs="0" maxOccurs="unbounded">
    <xsd:complexType>
     <xsd:sequence>
      <xsd:element name="productName" type="xsd:string"/>
      <xsd:element name="quantity">
       <xsd:simpleType>
        <xsd:restriction base="xsd:positiveInteger">
         <xsd:maxExclusive value="100"/>
        </xsd:restriction>
       </xsd:simpleType>
      </xsd:element>
      <xsd:element name="USPrice"  type="xsd:decimal"/>
      <xsd:element name="shipDate" type="xsd:date" minOccurs="0"/>
     </xsd:sequence>
    </xsd:complexType>
   </xsd:element>
  </xsd:sequence>
  <xsd:attribute name="shipBy">
   <xsd:simpleType>
    <xsd:restriction base="xsd:string">
     <xsd:enumeration value="air"/>
     <xsd:enumeration value="land"/>
     <xsd:enumeration value="any"/>
    </xsd:restriction>
   </xsd:simpleType>
  </xsd:attribute>
</xsd:complexType>

the restriction of the anonymous simple type for the element "quantity" is acceptable, but the restriction of the anonymous simple type for the attribute "shipBy" is not. Maybe this is just a misinterpretation in Xerces, but if it is intended to be allowed then what is the rationale for treating anonymous types of elements differently from anonymous types of attributes?

This seems very strange indeed. However, in your previous example I tried to get rid of the anonymous simple type

<xsd:simpleType name="upto100integer">
   <xsd:restriction base="positiveInteger">
      <xsd:maxExclusive value="100"/>
   </xsd:restriction>
</xsd:simpleType>

but I still got the same error from the Schema Quality Checker.

Cheers,
/Eddie