[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Problems with xs:redefine
Hi, On Thu, 2005-11-24 at 11:00 +0000, Paul Spencer wrote: > You are correct in saying that XML Spy 2004 does not detect this error, but > 2005 does. This (and inadequate testing) has led to at least one set of > invalid schemas being published as a "standard". > > When you use redefine, the new definitions must be legitimately derived from > the types you are redefining. Your simple type is derived from an xs:string. > You just need to change this to derive it from the original type. > > <xs:redefine schemaLocation="Events_1.6.xsd"> > <xs:simpleType name="RecurrenceIDRangeType"> > <xs:restriction base="RecurrenceIDRangeType"> > <xs:enumeration value="ThisAndFuture"/> > <xs:enumeration value="ThisAndPrior"/> > </xs:restriction> > </xs:simpleType> > > Your complex type is not a valid restriction, and I don't think you can > create one to do what you want. True, the complex type restriction won't work. If XML Schema's unique particle attribution (UPA) constraints [1] were not built to reflect a _deterministic_ finite state automaton, then you could define your base type as follows: <xs:element name="a"/> <xs:element name="b"/> (warning: this <xs:choice> is _not_ _valid_) <xs:choice minOccurs="0"> <xs:element ref="a"/> <xs:element ref="b"/> <xs:sequence> <xs:element ref="a"/> <xs:element ref="b"/> </xs:sequence> </xs:choice> ... removing the empty set using a restriction would only need the minOccurs to be set to 1: (warning: this <xs:choice> is _not_ _valid_) <xs:choice> <xs:element ref="a"/> <xs:element ref="b"/> <xs:sequence> <xs:element ref="a"/> <xs:element ref="b"/> </xs:sequence> </xs:choice> This would be a valid _restriction_. But, as already mentioned, both models violate the UPA constraints in the way that the automata, reflecting those models, would be non-deterministic. [1] http://www.w3.org/TR/xmlschema-1/#cos-nonambig --- Potential bug in Saxon 8.5.1: I noticed that it does not fire an UPA error for the above scenario; on the other hand it does fire the error if the @ref attributes are substituted for @name attributes. A "different/same element declaration" issue? --- [...] Regards, Kasimier
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|