Re: Unanswered Questions - recursive declaration

Ian,

> Is it legal XSDL to define an infinitely recursive structure?  For
> example (in XSDL shorthand):
>
> <element name="foo" type="bar" />
> <complexType name="bar">
>   <element name="foo" type="bar" minOccurs="1" maxOccurs="1"/>
> </complexType>

No it is not allowable [1] :

"Schema Component Constraint: Particle Emptiable

[Definition:]  For a particle to be emptiable one of the following must be
true:
1 Its {min occurs} is 0.
2 Its {term} is a group and the minimum part of the effective total range of
that group, as defined by Effective Total Range (all and sequence) (§3.8.6)
(if the group is all or sequence) or Effective Total Range (choice) (§3.8.6)
(if it is choice), is 0. "

Essentially the effective total range is not 0.

> I can imagine this would be fine if minOccurs="0" because it could
> conceivably terminate, however with minOccurs="1" an instance document
> with a "foo" element in it would be infinite and impossible to
> generate.

Yes this would be allowable.

[1] http://www.w3.org/TR/xmlschema-1/#cos-group-emptiable

Regards,
Jeff Rafter
Defined Systems
http://www.defined.net
XML Development and Developer Web Hosting

Received on Friday, 11 May 2001 13:57:42 UTC