RE: [RESEND] Derivation by restriction

Yes, the primer is in error. Attached is the mail thread regarding the
discussion. This was supposed to raised as an errata against the primer.


Thanks,
Priya

-----Original Message-----
From: Jeni Tennison [mailto:jeni@jenitennison.com] 
Sent: Saturday, March 16, 2002 3:22 AM
To: Dare Obasanjo
Cc: Xmlschema-Dev (E-mail)
Subject: Re: [RESEND] Derivation by restriction

Hi Dare,

> NOTE: The above constraint on {type definition}
> <http://www.w3.org/TR/xmlschema-1/#type_definition> means that in
> deriving a type by restriction, any contained type definitions must
> themselves be explicitly derived by restriction from the
> corresponding type definitions in the base definition.
>
> However this runs contrary to both the text in 'Essential XML Quick
> Reference' on XML Schema xs:restriction (p. 337) and the example in
> the XML Schema Primer[1] which imply that simply defining the
> contained type again in a derived type without the contained type
> deriving by restriction is allowable. XML Spy also validates both
> schemas.
>
> So are we interpreting the recommendation correctly or not?  

For what it's worth, I think that you are, and that the Primer is in
error.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Forwarded message 1

  • From: Ashok Malhotra <ashokma@microsoft.com>
  • Date: Mon, 19 Nov 2001 16:43:56 -0800
  • Subject: RE: XmlSchema giving invalid particle restriction on example from XML Schema primer
  • To: "Yan Leshinsky" <yanl@microsoft.com>, "Chris Lang" <clang@microsoft.com>, "Priya Lakshminarayanan" <priyal@microsoft.com>, "Eric Knox" <erickn@microsoft.com>, "XSD Interest Group" <xsdig@microsoft.com>, "Aung Aung" <aaung@microsoft.com>, "David Brown (WEBDATA)" <davebrow@microsoft.com>
  • Message-ID: <E5B814702B65CB4DA51644580E4853FB010406CF@red-msg-12.redmond.corp.microsoft.com>
Yes, please send a note to Henry.  Please also copy Lisa Martin  lmartin@ca.ibm.com 

This may be a known bug.  

All the best, Ashok 
=========================================================== 



-----Original Message-----
From: Yan Leshinsky 
Sent: Monday, November 19, 2001 4:08 PM
To: Chris Lang; Priya Lakshminarayanan; Eric Knox; XSD Interest Group; Aung Aung; David Brown (WEBDATA)
Subject: RE: XmlSchema giving invalid particle restriction on example from XML Schema primer

 

I agree with everything Priya have said - example from Primer is incorrect. 

Aung, David, can you follow up with Henry to make sure he is aware of this issue.

Thanks, Yan

-----Original Message-----
From: Chris Lang 
Sent: Monday, November 19, 2001 2:18 PM
To: Priya Lakshminarayanan; Eric Knox; XSD Interest Group; URT User Community
Subject: RE: XmlSchema giving invalid particle restriction on example from XML Schema primer

So, just to clarify our position on this, Microsoft is saying that the examples of restriction given in the non-normative portion of the XML Schema spec are not actually valid according to the spec itself. Is that right? Is this a known issue with the XML Schema spec, or is this position liable to be a controversial one? Apologies if this is all a well-known fact within the XSD community, as I'm only just getting my feet wet.

 

The reason I want to be clear is that we in the MapPoint .NET group are in the midst of providing feedback to our main industry standards body, the OpenGIS Consortium, on their proposed Geographic Markup Language 3.0, and it contains lots of instances of restriction like in the example below. Before we go and tell them that large parts of their schema are not valid, I want to make sure we're right. Less-stringent validators (XSV, XML Spy) don't seem to complain about it.

-----Original Message-----
From: Priya Lakshminarayanan 
Sent: Monday, November 19, 2001 10:39 AM
To: Eric Knox; XSD Interest Group; Chris Lang; URT User Community
Subject: RE: XmlSchema giving invalid particle restriction on example from XML Schema primer

If the derived and the base paricles are XmlSchemaElement, (as is the case here: element item) then the particle of the item element in the restricted type must fulfill the following constraint:

'Schema Component Constraint: Particle Restriction OK (Elt:Elt -- NameAndTypeOK)' ( <http://www.w3.org/TR/xmlschema-1/#rcase-NameAndTypeOK> http://www.w3.org/TR/xmlschema-1/#rcase-NameAndTypeOK).

 

The error is thrown because of this clause in the XmlSchema spec:

 

  7 R's  <http://www.w3.org/TR/xmlschema-1/#type_definition#type_definition> {type definition} is validly derived given {extension, list, union} from B's  <http://www.w3.org/TR/xmlschema-1/#type_definition#type_definition> {type definition} as defined by Type <http://www.w3.org/TR/xmlschema-1/#cos-ct-derived-ok#cos-ct-derived-ok>  Derivation OK (Complex) (§3.4.6) or Type <http://www.w3.org/TR/xmlschema-1/#cos-st-derived-ok#cos-st-derived-ok>  Derivation OK (Simple) (§3.14.6), as appropriate. 

NOTE: The above constraint on  <http://www.w3.org/TR/xmlschema-1/#type_definition#type_definition> {type definition} means that in deriving a type by restriction, any contained type definitions must themselves be explicitly derived by restriction from the corresponding type definitions in the base definition. 

 

This requires that the item element's type definition in ConfirmedItems must be an explicit restriction of its type in Items. But in the schema, they are anonymous types and there is no explicit restriction. Hence the schema component constraint isnt satisfied and the schema isnt valid. 

 

Thanks,

Priya

 

-----Original Message-----
From: Eric Knox 
Sent: Monday, November 19, 2001 9:07 AM
To: XSD Interest Group; Chris Lang; URT User Community
Subject: FW: XmlSchema giving invalid particle restriction on example from XML Schema primer

 

Fwd'ing to xsdig.

e-

 

-----Original Message-----
From: Chris Lang 
Sent: Friday, November 16, 2001 4:07 PM
To: URT User Community
Subject: XmlSchema giving invalid particle restriction on example from XML Schema primer

 

The attached file is essentially an example from the XML Schema Part 0: Primer document. I removed the parts about addresses to avoid including a second file, but the remaining complexTypes are exactly from that doc. Section 4.4 shows an example of derivation by restriction, and XmlSchema (build 3472) reports the following error when I try to compile it:

 

    Invalid particle derivation by restriction. An error occurred at (43, 2).

 

Is the example in error or is XmlSchema wrong? The problem seems to be that it does not consider the anonymous types in the derived type to be valid extensions of the anonymous types in the base, but I don't know enough about XML Schema to know if they should be or not.


I get this error all the time trying to compile real-world schemas, and at first I thought those schemas were in error, but now I see that even the example from the XML Schema spec doesn't work. Can someone explain?

 

Thanks.

 

 -Chris

 

Received on Monday, 18 March 2002 15:03:11 UTC