Another question of validity

Hey all,

After that last question about legal derivations, I came up with another
case where Xerces complains of invalid restriction, but I can't seem to
figure out why.  Here's the sample schema:

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.test.com/test"
xmlns:test="http://www.test.com/test">
	<complexType name="basicBitType" abstract="true">
		<sequence>
			<element name="testElement" type="token"
maxOccurs="unbounded"/>
		</sequence>
	</complexType>
	<complexType name="restrictedBasicBitType">
		<complexContent>
			<restriction base="test:basicBitType">
				<sequence>
					<element name="testElement"
type="token" maxOccurs="100"/>
				</sequence>
			</restriction>
		</complexContent>
	</complexType>
	<element name="basicBit" type="test:basicBitType"
abstract="true"/>
	<element name="restrictedBasicBit"
type="test:restrictedBasicBitType" substitutionGroup="test:basicBit"/>
	<complexType name="basicBitContainerType">
		<sequence>
			<element ref="test:basicBit"/>
		</sequence>
	</complexType>
	<complexType name="restrictedBasicBitContainerType">
		<complexContent>
			<restriction base="test:basicBitContainerType">
				<sequence>
					<element
ref="test:restrictedBasicBit"/>
				</sequence>
			</restriction>
		</complexContent>
	</complexType>
	<!-- this part makes it fail! -->
	<complexType name="superRestrictedBasicBitType">
		<complexContent>
			<restriction base="test:restrictedBasicBitType">
				<sequence>
					<element name="testElement"
type="token"/>
				</sequence>
			</restriction>
		</complexContent>
	</complexType>
	<element name="superRestrictedBasicBit"
type="test:superRestrictedBasicBitType"
substitutionGroup="test:restrictedBasicBit"/>
</schema>


If I remove the last two definitions
(complexType:superRestrictedBasicBitType and
element:suerRestrictedBasicBit) then this schema validates.  But adding
them to the schema seems to make Xerces choke.

Since the restriction in superRestrictedBasicBitType is a valid
restriction with respect to both restrictedBasicBitType and
basicBitType, why would adding it to the substitutiongroup of
restrictedBasicBit make any difference?  Is Xerces simply not checking
the other substitutionGroups for validity?  Or is this really invalid?

Thanks again for the help!

--saul


GIS Web Services
MassGIS - Executive Office of Environmental Affairs

251 Causeway Street
5th Floor
Boston, MA  02114
617-626-1145 

Received on Tuesday, 9 November 2004 22:04:36 UTC