Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem using xs:extension with a type

Status
Not open for further replies.

sedj

Programmer
Aug 6, 2002
5,610
Hi,
Hopefully someone can see where I'm going wrong here ...

I have a 'common' xsd :

Code:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema 
	   xmlns:xs="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema"[/URL] 
	   targetNamespace="Common" 
	   elementFormDefault="qualified" attributeFormDefault="unqualified">
	
	<xs:complexType name="DefaultIdBlock">
		<xs:all>
			<xs:element name="TransactionDetails">
				<xs:complexType>
					<xs:all>
						<xs:element name="OriginatingID" type="xs:string"/>
						<xs:element name="RecipientID" type="xs:string"/>
						<xs:element name="Timestamp" type="xs:dateTime"/>
						<xs:element name="TransactionID" type="xs:string" minOccurs="0"/>
					</xs:all>
				</xs:complexType>
			</xs:element>
		</xs:all>
	</xs:complexType>

</xs:schema>

And I have another XSD, which I wish to extend the 'DefaultIdBlock' type in the 'Common' namespace :

Code:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema 
	   xmlns:xs="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema"[/URL] 
	   xmlns:xsi="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance"[/URL] 
	   xmlns:CS="Common" 
	   elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:import namespace="Common" schemaLocation="Common.xsd"/>
	
	<xs:element name="Main">
		<xs:complexType>
			<xs:sequence>
				
				<xs:element name="Identification">
					<xs:complexType>
						<xs:complexContent>
							<xs:extension base="CS:DefaultIdBlock">
								<xs:all>
									<xs:element name="Identifier" type="xs:string"/>
								</xs:all>
							</xs:extension>
						</xs:complexContent>
					</xs:complexType>
				</xs:element>
			
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>

However, the schema fails to validate, with an error which I just do not understand !
The error is :

Code:
An all model group must appear in a particle with {min occurs} = {max occurs} = 1, and that particle must be part of a pair which constitutes the {content type} of a complex type definition

Anybody any idea how I can achieve my goal of having a base type, and then extending it in another schema ?

Cheers

Ben

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top