users@jaxb.java.net

Re: XJC throwing a ClassCastException when parsing schema

From: Ed Mooney <Ed.Mooney_at_Sun.COM>
Date: Mon, 17 Nov 2003 11:12:48 -0500

Hi Adam,

Here's the error I got:

     [ERROR] src-ct.1: Complex Type Definition Representation Error for
type 'dodgyType'. When complexContent is used, the base type must be a
complexType.
       line 12 of test.xsd

This comes from Xerces. I believe it means your schema violates section
3.4.3[1] of XSD Part 1. That is, the base type of your complexContent
needs to be a complex type, not xsd:string (a simple type).

It's probably a bug that xjc throws ClassCastException when it tries to
compile your larger schema. If you're willing to share it (privately, if
you'd like), that would help us track it down.

Regards,
-- 
Ed Mooney         |Sun Microsystems, Inc.|Time flies like
Java Web Services |UBUR02-201            |an arrow, but
Ed.Mooney_at_Sun.COM |1 Network Drive       |fruit flies like
781-442-0459      |Burlington, MA  01803 |a banana. Groucho
[1] 
http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#section-Constraints-on-XML-Representations-of-Complex-Type-Definitions
Adam Cohen-Rose wrote:
> We've narrowed the problem down to the following schema fragment.
> 
> It's a subtle error that isn't picked up by most validators - in fact it
> might even be a semantic error rather than a syntactic one.
> 
> Perhaps the error condition could be a little more revealing...?
> 
> Best wishes,
> 
> Adam & James
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="unqualified" attributeFormDefault="unqualified">
>   <xsd:element name="dodgyElement" type="dodgyType"/>
>   <xsd:complexType name="dodgyType">
>     <xsd:complexContent>
>       <xsd:extension base="xsd:string">
>         <xsd:sequence>
>           <xsd:element name="subelement" type="xsd:string" minOccurs="0"
> maxOccurs="unbounded"/>
>         </xsd:sequence>
>         <xsd:attribute name="attribute1" type="xsd:string"/>
>         <xsd:attribute name="attribute2" type="xsd:string"/>
>       </xsd:extension>
>     </xsd:complexContent>
>   </xsd:complexType>
> </xsd:schema>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
> 
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net