W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2003

XML validation fails when schema includes another schema

From: <ron@high-valley.com>
Date: Thu, 27 Feb 2003 23:02:45 -0500
Message-ID: <1046404965.3e5edf65868c2@webmail.high-valley.com>
To: xmlschema-dev@w3.org

Using MSXML4 SP1, I am unable to validate a document that XMLSpy 5 can validate 
just fine.  I have narrowed it down to the use of xs:include.  If my schema 
includes another schema a validation error is returned that says:

"The element 'RealTimeSIRequest' is used but not declared in the DTD/Schema"

Can someone eyeball the schema and see if they see anything wrong?

The below include scenario obviously is not useful, but it does illustrate the 
problem.

- Ron Thompson

XML:

<?xml version="1.0" encoding="UTF-8"?>
<RealTimeSIRequest xmlns="http://www.mysite.com/SI" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.mysite.com/SI
http://www.mysite.com/SI/TestRequestOneInclude.xsd">
	<RequestName>ContinueDisputeRequest</RequestName>
	<ContinueDisputeRequestBody>
		<CaseNumber>aaaaaa</VisaCaseNumber>
	</ContinueDisputeRequestBody>
</RealTimeSIRequest>

TestRequestOneInclude.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.mysite.com/SI" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:vsi="http://www.mysite.com/SI" elementFormDefault="qualified" 
attributeFormDefault="unqualified">
	<xs:include 
schemaLocation="http://www.mysite.com/SI/TestSharedNoInclude.xsd"/>
	<xs:complexType name="RequestType" abstract="true"/>
	<xs:element name="Request" type="vsi:RequestType"/>
	<xs:complexType name="RequestBodyType" abstract="true"/>
	<xs:element name="RequestBody" type="vsi:RequestBodyType"/>
	<xs:simpleType name="RequestNameType">
		<xs:restriction base="xs:string">
			<xs:enumeration value="LoginRequest"/>
			<xs:enumeration value="ChangePasswordRequest"/>
			<xs:enumeration value="LogoutRequest"/>
			<xs:enumeration value="InitiateDisputeRequest"/>
			<xs:enumeration value="ContinueDisputeRequest"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:element name="RealTimeSIRequest" 
type="vsi:RealTimeSIRequestType"/>
	<xs:complexType name="RealTimeSIRequestType">
		<xs:complexContent>
			<xs:extension base="vsi:RequestType">
				<xs:sequence>
					<xs:element 
name="RequestName" type="vsi:RequestNameType"/>
					<xs:element 
ref="vsi:RequestBody"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="ContinueDisputeRequestBodyType">
		<xs:complexContent>
			<xs:extension base="vsi:RequestBodyType">
				<xs:sequence>
					<xs:element 
name="MemberNumber" type="xs:string" minOccurs="0"/>
					<xs:element name="CaseNumber" 
type="xs:string" minOccurs="0"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:element name="ContinueDisputeRequestBody" 
type="vsi:ContinueDisputeRequestBodyType" substitutionGroup="vsi:RequestBody"/>
</xs:schema>

TestSharedNoInclude.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.mysite.com/SI" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:vsi="http://www.mysite.com/SI' elementFormDefault="qualified" 
attributeFormDefault="unqualified">
</xs:schema>

-------------------------------------------------
This mail was sent using www.Now2net.net
Received on Thursday, 27 February 2003 23:04:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:36 GMT