W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2002

RE: parsing a xml file against the schema

From: Priscilla Walmsley <priscilla@walmsley.com>
Date: Tue, 16 Apr 2002 14:47:06 -0400
Message-ID: <01C1E555.99C9BAC0.priscilla@walmsley.com>
To: "'zahra.valaie@firstunion.com'" <zahra.valaie@firstunion.com>, "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Hi again,

After looking at it more closely, I found a problem in your schema.  You have an element declaration that looks like this:

<xs:element name="Amount" maxOccurs="3">
	<xs:complexType>
		<xs:simpleContent>
			<xs:restriction base="xs:decimal">
				<xs:totalDigits value="10"/>
				<xs:fractionDigits value="2"/>
			</xs:restriction>
		</xs:simpleContent>
	</xs:complexType>
</xs:element>

You can't restrict a simple type to result in a complex type with simple content.  It should look like this instead:

<xs:element name="Amount" maxOccurs="3">
	<xs:simpleType>
		<xs:restriction base="xs:decimal">
			<xs:totalDigits value="10"/>
			<xs:fractionDigits value="2"/>
		</xs:restriction>
	</xs:simpleType>
</xs:element>

Once I changed that, I got the expected errors from Xerces-J 2.0.1 (for the strings instead of integer values).

Hope that helps!

Priscilla

-----------------------------------------------------
Priscilla Walmsley             priscilla@walmsley.com
Author, Definitive XML Schema     (Prentice Hall PTR)
-----------------------------------------------------
Received on Tuesday, 16 April 2002 14:44:34 GMT

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