W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2002

Re: Circular types in XML Schemas

From: Jerome Louvel <jerome_louvel@yahoo.fr>
Date: Fri, 3 May 2002 13:21:28 -0400 (EDT)
Message-ID: <3CD2C6DE.2080904@yahoo.fr>
To: xmlschema-dev@w3.org
Hi all,

>> What does the XML Schema specification says about infinite recursive
>> types, i.e. the ones that do not have a minOccurs="0" as a loophole?
> As far as I know, nothing. I think that it's quite difficult for a
> schema validator to test for this kind of unsatisfiable schema, though
> you'd find out soon enough that there was something wrong if you
> tested the schema against any instance document!

After reading this thread, I still don't see *why* the specification 
would prevent circular model groups only when reused as a "direct model 
group particule" (at any depth), but not when such a group is 
"indirectly reused" through an element declaration.

For example, if the model group definition below is invalid (note the 
minOccurs = 0) according to the "Model Group Correct" constraint 
preventing circular groups:

<xs:group name="error">
     <xs:group ref="ms:error" minOccurs="0"/>

Then, I don't see why the other one below would be a valid one.

<xs:group name="error">
     <xs:element name="error">
         <xs:group ref="ms:error" />

I do see an interest in using recursive types when ensuring that a 
minOccurs=0 or via a nillable property defined correctly, but if 
recursive types are allowed, I think there is an inconsistency of
treatment with "pure" model groups in the XSD spec.

> In general, the schema component constraints don't test every thing
> you could do to make it impossible for an instance to validate against
> your schema. For example, it's very easy to create identity
> constraints that are unsatisfiable (because they try to select nodes
> that don't exist), or to create simple types that have no valid
> lexical representations (because you use a pattern that doesn't match
> the base type, for example). It's therefore essential, during
> development, to test schemas against instance document that you know
> are valid.

I agree, but I think it would be useful if the specification could make 
the distinction between schema constraints that must be enforced by an
instance validator and other that would be more of the responsability of 
the person writing the schema or the responsability of a schema design 

Jerome Louvel.
Received on Saturday, 4 May 2002 06:40:11 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:56 UTC