Hi Abhideep. Thanks for reporting this bug. It's fixed in CVS. We were
building the 1.4.2 release at about the same time. So I'm not quite sure
whether this fix is in 1.4.2.
Cheers,
Sandy Gao
Software Developer, IBM Canada
(1-416) 448-3255
[EMAIL PROTECTED]
Abhideep Singh
<ASingh@zaplet To: "'[EMAIL PROTECTED]'"
<[EMAIL PROTECTED]>
.com> cc:
Subject: Validation Problems with
extension
07/19/2001
07:10 PM
Please respond
to
xerces-j-dev
I have defined a complexType called ShapeCollection which containes an
unbounded number of shapeElements of the type shapeType in the file
shape.xsd
shapeType is extended by type circleType defined in circle.xsd
The XML file with just one CircleType (shapeTest1.xml) validates fine. But
the XML file with with more than one CircleType fails validation. Am I
doing
something wrong or is this a bug with teh Parser.
Thanks a lot
Abhideep
============= shape.xsd ====================
<?xml version="1.0"?>
<xsd:schema
targetNamespace="http://www.xyz.com/schemas/2001/02/shapeCollectionType"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xyz="http://www.xyz.com/schemas/2001/02/shapeCollectionType">
<xsd:element name="shapeCollection" type="xyz:shapeCollectionType" />
<xsd:complexType name="shapeCollectionType">
<xsd:sequence>
<xsd:element name="shapeCollectionName" type="xsd:string"
minOccurs="1" maxOccurs="1"/>
<xsd:element name="shapeElement" type="xyz:shapeType"
minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="shapeType">
<xsd:sequence>
<xsd:element name="shapeName" type="xsd:string" minOccurs="1"
maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
============= circle.xsd ====================
<?xml version="1.0"?>
<xsd:schema targetNamespace="http://www.xyz.com/schemas/2001/02/circleType"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:circle="http://www.zaplet.com/schemas/2001/02/circleType"
xmlns:xyz="http://www.xyz.com/schemas/2001/02/shapeCollectionType">
<xsd:import
namespace="http://www.xyz.com/schemas/2001/02/shapeCollectionType"
schemaLocation="shape.xsd"/>
<xsd:complexType name="circleType">
<xsd:complexContent>
<xsd:extension base="xyz:shapeType">
<xsd:sequence>
<xsd:element name="radius" type="xsd:integer"
minOccurs="1" maxOccurs="1"/>
<xsd:element name="xCoordinate" type="xsd:string"
minOccurs="1" maxOccurs="1" />
<xsd:element name="yCoordinate" type="xsd:string"
minOccurs="1" maxOccurs="1" />
<xsd:element name="zCoordinate" type="xsd:string"
minOccurs="1" maxOccurs="1" />
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
============= shapeTest1.xml ====================
<?xml version="1.0"?>
<xyz:shapeCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xyz="http://www.xyz.com/schemas/2001/02/shapeCollectionType"
xsi:schemaLocation="http://www.xyz.com/schemas/2001/02/shapeCollectionType
shape.xsd">
<shapeCollectionName>CircleCollection</shapeCollectionName>
<shapeElement
xmlns:circle="http://www.xyz.com/schemas/2001/02/circleType"
xsi:schemaLocation="http://www.xyz.com/schemas/2001/02/circleType
circle.xsd"
xsi:type="circle:circleType">
<shapeName>Sphere</shapeName>
<radius>3</radius>
<xCoordinate>1</xCoordinate>
<yCoordinate>1</yCoordinate>
<zCoordinate>1</zCoordinate>
</shapeElement>
</xyz:shapeCollection>
============= shapeTest2.xml ====================
<?xml version="1.0"?>
<xyz:shapeCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xyz="http://www.xyz.com/schemas/2001/02/shapeCollectionType"
xsi:schemaLocation="http://www.xyz.com/schemas/2001/02/shapeCollectionType
shape.xsd">
<shapeCollectionName>CircleCollection</shapeCollectionName>
<shapeElement
xmlns:circle="http://www.xyz.com/schemas/2001/02/circleType"
xsi:schemaLocation="http://www.xyz.com/schemas/2001/02/circleType
circle.xsd"
xsi:type="circle:circleType">
<shapeName>Circle</shapeName>
<radius>3</radius>
<xCoordinate>1</xCoordinate>
<yCoordinate>1</yCoordinate>
<zCoordinate>1</zCoordinate>
</shapeElement>
<shapeElement
xmlns:circle="http://www.xyz.com/schemas/2001/02/circleType"
xsi:schemaLocation="http://www.xyz.com/schemas/2001/02/circleType
circle.xsd"
xsi:type="circle:circleType">
<shapeName>Circle</shapeName>
<radius>3</radius>
<xCoordinate>1</xCoordinate>
<yCoordinate>1</yCoordinate>
<zCoordinate>1</zCoordinate>
</shapeElement>
</xyz:shapeCollection>
============= Exceptions ====================
[Error] shapeTest2.xml:17:32: General Schema Error: Type :
http://www.xyz.com/schemas/2001/02/circleType,circleType does not derive
from the type of element zCo
ordinate.
Exception in thread "main" org.xml.sax.SAXParseException: General Schema
Error:
Type : http://www.xyz.com/schemas/2001/02/circleType,circleType does not
derive
from the type of element zCoordinate.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]