Thanks Jacob for your quick response on this. OK - using the org.apache.xmlbeans.impl.xb.xsdschema package, and not compiling the XMLSchema.xsd schema myself, looks like it is working fine. thanks again, Scott
-----Original Message----- From: Jacob Danner [mailto:[EMAIL PROTECTED] Sent: Friday, May 30, 2008 5:31 PM To: user@xmlbeans.apache.org; [EMAIL PROTECTED] Subject: Re: CastException with parsing instance of compiled XMLSchema.xsd Hi Scott, I think you are getting this issue because XMLBeans already includes types generated from XMLSchema.xsd. The error message you are seeing indicates the packages for the already compiled xmlbean types in the org.apache.xmlbeans.impl.xb.xsdschema package While the packages are not the same, the metadata (.xsb) files reference the same namespaces and thats where this error is most likely coming from. As a solution, you should just use the schema classes included in the org.apache.xmlbeans.impl.xb.xsdschema package . HTH, -jacobd On Fri, May 30, 2008 at 3:09 PM, Scott Hinkelman <[EMAIL PROTECTED]> wrote: > Hi, > I am receiving the following exception when parsing an existing instance > after compiling the XMLSchema.xsd from W3C. The instance file was generated > using the bindings with no problems, but can not read it back. It appears > the cast problem is happening inside the external API which is generated. > This is of course a unique xsd. I am using the same code approach which I > use successfully with my other xsd file: > > java.lang.ClassCastException: > org.apache.xmlbeans.impl.xb.xsdschema.impl.SchemaDocumentImpl cannot be cast > to org.w3.x2001.xmlSchema.SchemaD > ocument > at > org.w3.x2001.xmlSchema.SchemaDocument$Factory.parse(SchemaDocument.java:766) > at > com.oracle.aia.content.examples.XMLSchemaTest1.main(XMLSchemaTest1.java:55) > > Code snip where the cast exception occurs: > File outfile=new File("out.xml"); > org.w3.x2001.xmlSchema.SchemaDocument doc2 = > org.w3.x2001.xmlSchema.SchemaDocument.Factory.parse(outfile); > > XMLBeans is version 2.3.0. > > Any ideas? > Thanks, > > Scott H. -- I'm competing in a Half-Ironman distance triathlon to raise money for the fight against cancer! Please help support my efforts by going to: http://www.active.com/donate/tntwaak/jacobd --------------------------------------------------------------------- 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]