- From: Takuki Kamiya <takuki@pacbell.net>
- Date: Thu, 11 Apr 2002 18:22:51 -0700
- To: "Eddie Robertsson" <erobertsson@allette.com.au>, "XSD" <xmlschema-dev@w3.org>
Hi, Interesting. I have a version of schema for schema that I have been using in production system for quite some time, so you might want to take a look for comparison. It works with xerces 1.4.3 and 2.0.0. -taki ----- Original Message ----- From: "Eddie Robertsson" <erobertsson@allette.com.au> To: "XSD" <xmlschema-dev@w3.org> Sent: Wednesday, April 10, 2002 1:02 AM Subject: Schema for schemas bugs? > Hi all, > > Since the schema at http://www.w3.org/2001/XMLSchema.xsd can't be used > directly for validation I've rewritten it so that it now can be used to > validate an XML Schema document. Most changes involved the removal of > the type definitions for the built-in primitive datatypes but I also had > to modify some of the complexTypes since they wouldn't pass validation. > These complexTypes are: > > * complexRestrictionType AND simpleRestrictionType > * groupRef AND attributeGroupRef > * all > > Different validators give me different results so I'd appreciate your > comments before reporting this as a bug in any of the validators. > > complexRestrictionType AND simpleRestrictionType > ----------------------------------------------------- > Both these types are very similar so I'll illustrate with > complexRestrictionType. The relevant types in the XMLSchema.xsd file > are: > > <xs:complexType name="openAttrs"> > <xs:complexContent> > <xs:restriction base="xs:anyType"> > <xs:anyAttribute namespace="##other" processContents="lax"/> > </xs:restriction> > </xs:complexContent> > </xs:complexType> > > <xs:complexType name="annotated"> > <xs:complexContent> > <xs:extension base="xs:openAttrs"> > <xs:sequence> > <xs:element ref="xs:annotation" minOccurs="0"/> > </xs:sequence> > <xs:attribute name="id" type="xs:ID"/> > </xs:extension> > </xs:complexContent> > </xs:complexType> > > <xs:complexType name="restrictionType"> > <xs:complexContent> > <xs:extension base="xs:annotated"> > <xs:sequence> > <xs:choice> > <xs:group ref="xs:typeDefParticle" minOccurs="0"/> > <xs:group ref="xs:simpleRestrictionModel" minOccurs="0"/> > </xs:choice> > <xs:group ref="xs:attrDecls"/> > </xs:sequence> > <xs:attribute name="base" type="xs:QName" use="required"/> > </xs:extension> > </xs:complexContent> > </xs:complexType> > > <xs:complexType name="complexRestrictionType"> > <xs:complexContent> > <xs:restriction base="xs:restrictionType"> > <xs:sequence> > <xs:element ref="xs:annotation" minOccurs="0"/> > <xs:group ref="xs:typeDefParticle" minOccurs="0"/> > <xs:group ref="xs:attrDecls"/> > </xs:sequence> > </xs:restriction> > </xs:complexContent> > </xs:complexType> > > Most schema validators give me an error saying that the last derivation > by restriction is not valid. However, it feels to me that this > derivation step should be valid since the resolved xs:restrictionType > would be: > > <xs:complexType name="restrictionType_resolved"> > <xs:sequence> > <xs:element ref="xs:annotation" minOccurs="0"/> > <xs:sequence> > <xs:choice> > <xs:group ref="xs:typeDefParticle" minOccurs="0"/> > <xs:group ref="xs:simpleRestrictionModel" minOccurs="0"/> > </xs:choice> > <xs:group ref="xs:attrDecls"/> > </xs:sequence> > </xs:sequence> > <xs:attribute name="base" type="xs:QName" use="required"/> > <xs:attribute name="id" type="xs:ID"/> > </xs:complexType> > > It seems to me that xs:complexRestrictionType is a valid restriction of > this type. > > groupRef AND attributeGroupRef > ----------------------------------- > Again these two types are similar in their derivation chain so I'll use > groupRef to illustrate. The relevant types are (+ annotated and > openAttrs above): > > <xs:complexType name="group" abstract="true"> > <xs:complexContent> > <xs:extension base="xs:annotated"> > <xs:group ref="xs:particle" minOccurs="0" maxOccurs="unbounded"/> > <xs:attributeGroup ref="xs:defRef"/> > <xs:attributeGroup ref="xs:occurs"/> > </xs:extension> > </xs:complexContent> > </xs:complexType> > > <xs:complexType name="realGroup"> > <xs:complexContent> > <xs:restriction base="xs:group"> > <xs:sequence> > <xs:element ref="xs:annotation" minOccurs="0"/> > <xs:choice minOccurs="0" maxOccurs="1"> > <xs:element ref="xs:all"/> > <xs:element ref="xs:choice"/> > <xs:element ref="xs:sequence"/> > </xs:choice> > </xs:sequence> > </xs:restriction> > </xs:complexContent> > </xs:complexType> > > <xs:complexType name="groupRef"> > <xs:complexContent> > <xs:restriction base="xs:realGroup"> > <xs:sequence> > <xs:element ref="xs:annotation" minOccurs="0"/> > </xs:sequence> > <xs:attribute name="ref" use="required" type="xs:QName"/> > <xs:attribute name="name" use="prohibited"/> > </xs:restriction> > </xs:complexContent> > </xs:complexType> > > The situation is similar to the previous, some validators give an error > in the last derivation step saying that groupRef is not a valid > restriction of realGroup. Again I think that this restriction is fine. > > all > --- > All validators I've tried with give me an error on this derivation > chain. The types involved are: > > <xs:complexType name="explicitGroup"> > <xs:complexContent> > <xs:restriction base="xs:group"> > <xs:sequence> > <xs:element ref="xs:annotation" minOccurs="0"/> > <xs:group ref="xs:nestedParticle" minOccurs="0" > maxOccurs="unbounded"/> > </xs:sequence> > <xs:attribute name="name" type="xs:NCName" use="prohibited"/> > <xs:attribute name="ref" type="xs:QName" use="prohibited"/> > </xs:restriction> > </xs:complexContent> > </xs:complexType> > > <xs:complexType name="all"> > <xs:complexContent> > <xs:restriction base="xs:explicitGroup"> > <xs:group ref="xs:allModel"/> > <xs:attribute name="minOccurs" use="optional" default="1"> > <xs:simpleType> > <xs:restriction base="xs:nonNegativeInteger"> > <xs:enumeration value="0"/> > <xs:enumeration value="1"/> > </xs:restriction> > </xs:simpleType> > </xs:attribute> > <xs:attribute name="maxOccurs" use="optional" default="1"> > <xs:simpleType> > <xs:restriction base="xs:allNNI"> > <xs:enumeration value="1"/> > </xs:restriction> > </xs:simpleType> > </xs:attribute> > </xs:restriction> > </xs:complexContent> > </xs:complexType> > > In this case I agree with the validators since in the "all" complexType > restriction the group xs:allModel is referenced without being declared > in the the base type. > > I'd appreciate any comments you might have about this. > > Cheers, > /Eddie > > > > >
Received on Thursday, 11 April 2002 21:21:53 UTC