Dear XERCES user's list,

I posted this question with no sample files a while ago because every time I
tried to simplify and narrow down the problem, the problem went away. I hope
the attached files are easy enough examples to debug.

Two schemas, amb.xsd and abc.xsd, and an instance file
test.xml are attached. When validation of the schema is performed
using Xerces version 1.4.3, Xerces provides the following error message:

[Error] test.xml:8:44: General Schema Error: Type : http://www.ara.com/abc,
DescriptionType does not derive from the type http://www.ara.com/abc,
#AnonType_No.

This error message is surprising because the elements "No" and
"DescriptionType" are
totally unrelated and the error implies that "DescriptionType" should derive
from the
element "No." If one deletes the line
       <xsd:element name="Description" type="xsd:string" minOccurs="0"/>
where Description is a subelement of element AM (see file AMB.xsd, line 14),
the error goes away. Yet this element has nothing to do with elements
DescriptionType or No.

The parser seems to behave as if there was a memory override causing the
error messaging system to produce a bizarre error. Can someone help me
figure this out?
Thanks

- John Powell
Applied Research Associates, Inc.

NOTES:
1)To check the above, you will have to modify the full or relative path to
schemas given in the files test.xml and abc.xsd to match the location of the
files on your computer.
2)I also used XSV to validate the instance and XSV does not give any error.
3)IBM Schema Quality Checker reports not errors with the two Schema files.



<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.ara.com/abc"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:abc="http://www.ara.com/abc"; xmlns:amb="http://www.ara.com/amb"; elementFormDefault="qualified">
	<xsd:import namespace="http://www.ara.com/amb"; schemaLocation="file:///D:/Projects/0507/research/schemas/AMB.xsd"/>
	<xsd:complexType name="DescriptionType">
		<xsd:complexContent>
			<xsd:extension base="amb:MDType">
				<xsd:sequence>
					<xsd:element ref="abc:NList"/>
					<xsd:element ref="abc:NGroups" minOccurs="0"/>
				</xsd:sequence>
			</xsd:extension>
		</xsd:complexContent>
	</xsd:complexType>
	<xsd:element name="NLoc">
		<xsd:complexType>
			<xsd:choice>
				<xsd:element name="NNumber" type="xsd:positiveInteger"/>
				<xsd:element name="NGroupName" type="xsd:string"/>
			</xsd:choice>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="NGroups">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="abc:NGroup" maxOccurs="unbounded"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="NGroup">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="Nos" type="amb:ListOfPositiveIntegers"/>
			</xsd:sequence>
			<xsd:attribute name="name" type="xsd:string" use="required"/>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="NList">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="abc:No" maxOccurs="unbounded"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="No">
		<xsd:complexType>
			<xsd:choice>
				<xsd:element name="C2" type="amb:C2"/>
				<xsd:element name="C3" type="amb:C3"/>
			</xsd:choice>
			<xsd:attribute name="id" type="xsd:positiveInteger" use="required"/>
		</xsd:complexType>
	</xsd:element>
</xsd:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.ara.com/amb"; xmlns:amb="http://www.ara.com/amb"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xsd:element name="AP">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="Description" type="xsd:string" minOccurs="0"/>
				<xsd:element ref="amb:AM"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="AM">
		<xsd:complexType>
			<xsd:sequence>
                        <xsd:element name="Description" type="xsd:string" minOccurs="0"/>
				<xsd:element ref="amb:D" maxOccurs="unbounded"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="D">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="Description" type="xsd:string" minOccurs="0"/>
				<xsd:element ref="amb:Castro" maxOccurs="unbounded"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="Castro">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="Description" type="xsd:string" minOccurs="0"/>
				<xsd:element name="MD" type="amb:MDType"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:complexType name="MDType">
		<xsd:sequence>
			<xsd:element name="MD" type="amb:MD"/>
			<xsd:element name="NC" type="xsd:string" minOccurs="0"/>
			<xsd:element name="U" type="amb:UT" minOccurs="0"/>
		</xsd:sequence>
		<xsd:attribute name="D" type="xsd:string" use="optional"/>
	</xsd:complexType>
	<xsd:simpleType name="UT">
		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="M"/>
			<xsd:enumeration value="E"/>
		</xsd:restriction>
	</xsd:simpleType>
	<xsd:simpleType name="MD">
		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="A"/>
			<xsd:enumeration value="D"/>
		</xsd:restriction>
	</xsd:simpleType>
	<xsd:simpleType name="ListOffloats">
		<xsd:list itemType="xsd:float"/>
	</xsd:simpleType>
	<xsd:simpleType name="ListOfPositiveIntegers">
		<xsd:list itemType="xsd:positiveInteger"/>
	</xsd:simpleType>
	<xsd:simpleType name="C2">
		<xsd:restriction base="amb:ListOffloats">
			<xsd:length value="2"/>
		</xsd:restriction>
	</xsd:simpleType>
	<xsd:simpleType name="C3">
		<xsd:restriction base="amb:ListOffloats">
			<xsd:length value="3"/>
		</xsd:restriction>
	</xsd:simpleType>
</xsd:schema>
<?xml version="1.0"?>
<amb:AP xmlns:abc="http://www.ara.com/abc"; xmlns:amb="http://www.ara.com/amb"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation=" http://www.ara.com/abc abc.xsd">
	<amb:Description>This is a test</amb:Description>
	<amb:AM>
		<amb:D>
			<amb:Castro>
				<amb:MD xsi:type="abc:DescriptionType">
			            <amb:MD>A</amb:MD>
					<abc:NList>
						<abc:No id="1">
							<abc:C3>0.0 0.0 0.0</abc:C3>
						</abc:No>
					</abc:NList>
					<abc:NGroups>
						<abc:NGroup name="E">
							<abc:Nos>1</abc:Nos>
						</abc:NGroup>
					</abc:NGroups>
				</amb:MD>
			</amb:Castro>
		</amb:D>
	</amb:AM>
</amb:AP>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to