On Monday, June 30, 2003, at 01:49 AM, Claus Ibsen wrote:
Using Castor v0.95

We have 27 .xsd files that is generated into .java code using Castor.
Damm there are some naming conflicts and we have solved most of them by
renaming the element names in the .xsd files.

Are the XSDs in different namespaces? (I assume they are, otherwise you'd have the same naming conflicts at the XML level.) If so, have you considered building them into separate packages? See the documentation for org.exolab.castor.builder.nspackages.


Lately I wanted to check out the Castor bindings file but it fails.

Basically I have to complex types with the same name but with different
content. Therefore Castor generates two .java files with the same name
and thus overwrites the previously generated. Sadly you don't get any
warning from the source code generator that a file already exists!!!

This is a flaw, to be sure.


I have this compex element (Listing_List) I want to be renamed, so
I don't have a java class naming conflict:

<Message_Data>
  <Message_Body>
    <CompletePaidList>
       <Listing_List>
  ...

Yes all the elements above are complexTypes.

When you have a question like this, it is nice if you can provide a schema fragment so that it is clear what the problem is. I'm going to guess from your description that it is something like this:


<xsd:element name="CompletePaidList" type="CPLType"/>

<xsd:complexType name="CPLType"/>
        <xsd:sequence>
                <xsd:element name="Listing_List" type="CPL_Listing_ListType"/>
        </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="CPL_Listing_ListType"/>
        <whatever/>
</xsd:complexType>

If so, changing to 'type' mapping from 'element' mapping will probably do what you want. This is done by setting org.exolab.castor.builder.javaclassmapping=type in castorbuilder.properties.

So my bindings file is:

    <cbf:elementBinding name="complexType:Listing_List">
        <cbf:java-class name="My_Listing_List"/>
    </cbf:elementBinding>

But it fails all the time.

Again, you need to provide a schema fragment in order for someone to diagnose why you're having trouble. This example will never work, though, because it is saying "please alter the element binding for the complexType named 'Listing_List'." There is no element binding for a complexType on its own -- either use complexTypeBinding or provide the name of an element.


I have tried a lot of combinations. Do you have to input the fully
qualified path in the name? Or can it just be some kind of relative
path?

    <cbf:complexTypeBinding name="complexType:Listing_List">
        <cbf:java-class name="Damm"/>
    </cbf:complexTypeBinding>

It needs to be the full pseudo-XPath path to the element/attribute/complexType you want to bind. If you are dealing with named complexTypes, those have to be at the top level, so this example should work. Using the made-up schema above, the binding for the Listing_List element could be


<cbf:elementBinding name="CompletePaidList/Listing_List"/>

or

<cbf:elementBinding name="complexType:CPLType/Listing_List"/>

depending on the desired scope of the effects. The first example would apply only to the subelement Listing_List of the CompletePaidList element (and then only if CompletePaidList were a top level element in the XML doc). The second example applies to the Listing_List subelement of any element of the type CPLType.

HTH,
Rhett


-- Rhett Sutphin Research Assistant (Software) Coordinated Laboratory for Computational Genomics and the Center for Macular Degeneration University of Iowa - Iowa City - Iowa - 52246 mailto:[EMAIL PROTECTED]

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




Reply via email to