I discovered that the problem is not the scema or the xml, but the classpath.
I have many schemas and none of them have namespace declared. I can't change this because the schemas are coming form a service provider.
Approx. all the tags in schemas have the same name. You can find <RETURNDATA> and <DATA> in each schema. The first time i tried to generate the jar i got the "multiple occurences" error.
So i wrote a .xsdconfig for each schema, thus every schema have it's own package like: a.b.c.RETURNDATADocument or x.y.z.RETURNDATADocument
After the classCastException i added for each .xsdconfig file a _$ suffix where $ in (1, ...20).
So now all the classes are a.b.c.RETURNDATADocument_1, ...etc
If i try to parse a a.b.c.RETURNDATADocument_1 first , and it's jar in the first one in CLASSPATH it will work, but if i try after this to parse a x.y.z.RETURNDATADocument_2 i receive ClassCAstException.
If i put the jars in another order, the first operation will give ClassCast
PLease give me a clue at least!!
On Wed May 25 4:52 , 'Don Stewart' <[EMAIL PROTECTED]> sent:
Can you post the whole schema as I cannot see from the schema supplied the whole problem.ThanksDon
I made a small test: i used xmlbeans to generate a sample xml file then i tried to parse it. I received ClassCastException again!!! Please help me!!
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 25 May 2005 10:37
To: [email protected]
Subject: Re: ClassCastException
On Wed May 25 2:38 , <[EMAIL PROTECTED]> sent:
Hi!
I'm receiving a ClassCastException when i'm trying to parse a VALID xml file.I'm sure the xmlbeans.jar is the right one and the schema and xml file are OK. PLease give me a clue. I pasted here a piece form xml file and xml schema
Code:
fr.xxx.yyy.zzz.RETURNDATADocument rd = fr.xxx.yyy.zzz.RETURNDATADocument.Factory
.parse(new File("xxxx.xml"));Schema:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:annotation>
<xsd:documentation xml:lang="en">
Results of Hotel Details request, for a given Hotel Code.
Any error messages in "MESSAGE" element with
text "Error" followed by the error description
</xsd:documentation>
</xsd:annotation>
<xsd:element name="RETURNDATA">
<xsd:complexType>
-----------XML:
<?
xml version='1.0' encoding='UTF-8'?><RETURNDATA type='HDR' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://xx.yy.zz/aaa/HotelDetailRequestV4Rcv.xsd'>
<MESSAGE>Details of the requested Hotel</MESSAGE> <DATA HOTEL_CODE='AUS' COUNTRY_CODE='AUS' CITY_CODE='SZG' PRINCIPAL_CODE='TRAVCO' BOARD_BASIS_CODE='BB' CATEGORY_CODE='HOT'> <HOTEL_NAME>Austrotel</HOTEL_NAME> <COUNTRY_NAME>AUS</COUNTRY_NAME>............
</DATA>
</RETURNDATA>
--------------------------------------------------------------------- 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]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

