Hi Eric,

These are known and common issues. The problem occurs when an XML Schema
files contains both complexType definations and element declarations
with the same name as such:

<xsd:element name="foo" type="Foo"/>

This happens when using the default element-centric approach...but can
usually be worked around by using the type-centric approach, or using a
binding file.

In "element" mode, Castor will generate classes for both Elements and
ComplexTypes. The classes for the elements are the concrete classes and
the classes for the ComplexTypes are the superclasses.

Castor will create a class named "Foo" for the element foo, and then one
for the ComplexType Foo...obviously one class will conflict with the
other. 

Unfortunately Castor doesn't report the error in this case. There is a
bug report already open for this.

The solutions are to either switch to type mode (see castor.properties)
or use a binding file.

In "type" mode, only classes for ComplexTypes and elements with
anonymous complexType definitions are generated, so in most cases you
won't get the conflicting names. 

For more information on "type" and "element" binding modes, please see:

http://castor.exolab.org/sourcegen.html#Class-Creation/Mapping

You can also use a binding file to change the names of the generated
classes, for more information on this, please see here:

http://castor.exolab.org/sourcegen.html#Binding-File

--Keith



[EMAIL PROTECTED] wrote:
> 
> I'm trying to use Castor's SourceGenerator to create Java classes for some
> fairly complicated .xsd files (a proprietary extension to FpML).  The
> generated source contains hundreds of errors like this:
> 
> StepDescriptor causes a cycle - the type StepDescriptor cannot
> extend/implement itself or one of its own member types
> The method addFieldDescriptor(XMLFieldDescriptorImpl) is undefined for the
> type StepDescriptor
> The method getExtends() is undefined for the type Object
> The method getIdentity() is undefined for the type Object
> The method setCompositorAsSequence() is undefined for the type
> StepDescriptor
> The method setExtendsWithoutFlatten(StepDescriptor) is undefined for the
> type StepDescriptor
> Type mismatch: cannot convert from StepDescriptor to TypeValidator
> 
> I searched the mailing list archives and web sites but could not find
> similar problems.  The most glaring problem is that most of the Java
> classes extend themselves.  Any ideas?
> 
> This communication is for informational purposes only.  It is not intended as
> an offer or solicitation for the purchase or sale of any financial instrument
> or as an official confirmation of any transaction. All market prices, data
> and other information are not warranted as to completeness or accuracy and
> are subject to change without notice. Any comments or statements made herein
> do not necessarily reflect those of J.P. Morgan Chase & Co., its
> subsidiaries and affiliates.
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to