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

RE: XMLSpy and recursive schemas

From: Biron,Paul V <Paul.V.Biron@kp.org>
Date: Wed, 3 Jul 2002 09:33:26 -0700
Message-Id: <8904C60CACA7D51191BC00805FEAAF4358ED8C@crdc-exch-7.crdc.kp.org>
To: "'Ross Thompson'" <ross@contivo.com>, xmlschema-dev@w3.org

> -----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

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