[xsd-users] Recurse error parsing XSD

Robert Wruck wruck at tweerlei.de
Wed Feb 6 05:30:32 EST 2008


Hi,

I tried xsd cxx-parser (3.0.0) on one of our XSDs and it gave the 
following error:

test2.xsd:12:35: error: Recurse: There is not a complete functional 
mapping between the particles

All elements that are not included in the derived type have a 
minOccurs="0", so the Recurse rule is NOT validated.
Even more interesting, if I add the TopicID field as indicated below, 
xsd does not complain anymore.

The XSDs are:

===========
test.xsd
===========

<schema
	targetNamespace="http://example.org/schema1"
	xmlns="http://www.w3.org/2001/XMLSchema"
	xmlns:tns="http://example.org/schema1"
	elementFormDefault="unqualified"
	attributeFormDefault="unqualified"
	>

	<complexType name="Topic">
		<sequence>
			<element name="TopicID" type="string" minOccurs="0"/>
			<element name="TopicName" type="string"/>
			<element name="TopicDescription" type="string"/>
			<element name="CommunicationContent" type="string"/>
			<element name="CommunicationFormat" type="string"/>
			<element name="DataWarehouseExport" type="string" 
minOccurs="0"/>
			<element name="DaysAlive" type="string" minOccurs="0"/>
			<element name="Priority" type="string" minOccurs="0"/>
		</sequence>
	</complexType>

</schema>

===========
test2.xsd
===========

<schema
	targetNamespace="http://example.org/schema2"
	xmlns="http://www.w3.org/2001/XMLSchema"
	xmlns:tns="http://example.org/schema2"
	xmlns:schema1="http://example.org/schema1"
	elementFormDefault="unqualified"
	attributeFormDefault="unqualified"
	>
	
	<import namespace="http://example.org/schema1" 
schemaLocation="test.xsd"/>

	<complexType name="DerivedTopic">
		<complexContent>
			<restriction base="schema1:Topic">
				<sequence>
<!-- Add this to stop xsd from complaining ?!?
					<element name="TopicID" type="string" 
minOccurs="0"/>
-->
					<element name="TopicName" type="string"/>
					<element name="TopicDescription" type="string"/>
					<element name="CommunicationContent" type="string"/>
					<element name="CommunicationFormat" type="string"/>
				</sequence>			
			</restriction>
		</complexContent>		
	</complexType>

</schema>



Regards,
Robert Wruck




More information about the xsd-users mailing list