[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Complex type inheritance is evil!
- From: "K.Kawaguchi" <kohsukekawaguchi@yahoo.com>
- To: xml-dev@lists.xml.org
- Date: Wed, 06 Jun 2001 13:06:35 -0700
> My question:
> Is this an error in the Primer or in the validator? Or am I missing some
> arcane point about restrictions?
I think the latter is the case.
I believe the problem is the anonymous simple type definition.
You are using an anonymous type:
<xsd:simpleType>
<xsd:restriction base="positiveInteger">
<xsd:maxExclusive value="100"/>
</xsd:restriction>
</xsd:simpleType>
Although the spec is unclear about this, but in practice two
independently derived simple types are considered different, even if
they are derived in exactly the same way.
It is very hard for validators to consider them as equal. Imagine a
simple type who has tons of facets!
Things like this is just the tip of iceberg. So I'd suggest not to use
extension/restriction at all. As I advocate in my "DOs and DON'Ts".
http://www.geocities.com/kohsukekawaguchi/XMLSchemaDOsAndDONTs.html
Or if you really need to use restriction, then I think you can avoid the
problem by getting rid of anonymous datatypes.
<xsd:simpleType name="upto100integer">
<xsd:restriction base="positiveInteger">
<xsd:maxExclusive value="100"/>
</xsd:restriction>
</xsd:simpleType>
regards,
----------------------
K.Kawaguchi
E-Mail: kohsukekawaguchi@yahoo.com