RE: XMLSpy and recursive schemas

> -----Original Message-----
> From:	Ross Thompson [SMTP:ross@contivo.com]
> Sent:	Monday, July 01, 2002 9:25 AM
> To:	xmlschema-dev@w3.org
> Cc:	'xmlschema-dev@w3.org'
> Subject:	XMLSpy and recursive schemas
> 
> Every time I make a public statement on this list, I end up sticking
> my foot in my mouth, so this time I will be cautious:
> 
> I believe it may possibly be somewhat true, at some time past, present
> or future, that:
> 
> You cannot define elements or types in schema directly in terms of
> themselves.
> 
Ross, I hate to be the bearer of bad news, but...

...you can define a complex type one or more of whose child elements is of that complex type, as in:

<!-- in section.xsd -->
<?xml version="1.0" encoding="utf-8"?>
<xs:schema
		xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name='section' type='Section'/>
	<xs:complexType name='Section'>
		<xs:sequence>
			<xs:element name='section' type='Section' minOccurs='0'/>
		</xs:sequence>
	</xs:complexType>
</xs:schema>

<!-- in section.xml -->
<?xml version="1.0" encoding="utf-8"?>
<section
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 			
		xsi:noNamespaceSchemaLocation="section.xsd">
	<section>
		<section/>
	</section>
</section>

The above schema passes SQC, and the instance+schema combination passes XSV, MSV, xerces2 and XML Spy.

pvb

Received on Wednesday, 3 July 2002 13:00:09 UTC