Hi Paul,
With the type-approach Castor will generate classes for all complexTypes and any top-level elements. With the element-approach castor will generate a class for all elements and all complexTypes.
You should definately see a difference in the classes generated for both types. Did you delete the existing classes first before trying to regenerate?
--Keith
Paul Grillo wrote:
I tried both element and type and I get the same 12 classes generated.
Just tried it again to make sure I didn't miss anything, but there
appears to be no difference. I did check to insure it was picking up my
builder properties file (just in case) by also asking it to extend from
a super class.
It still looks like I get a class for every element that is of a complex type I've defined and that the getters for each require it to be cast as such. I'm trying to figure a workaround in my code that uses the classes, but it's sort of ugly. Hoping there was a clearcut approach.
-----Original Message-----
From: Keith Visco [mailto:[EMAIL PROTECTED] Sent: Thursday, January 27, 2005 2:25 PM
To: castor-dev@exolab.org
Subject: Re: [castor-dev] Source Generator - Advice/help? please
Paul,
Try generating your source code using the "type" approach. You can specify this in the "castorbuilder.properties" or in a binding-file if you're using one.
http://castor.exolab.org/sourcegen.html#Class-Creation/Mapping
--Keith
Paul Grillo wrote:
I would really appreciate some help on this, i'm sort of up against it. any help would be "greatly" appreciated...
I have a fairly complex schema that i'm generating java for. I have flexibility to change the schema, write binding files, or whatever. I
guess i'm having a problem understanding how to get the source generator to do what i think is fairly straightforward.
I have reproduced this as simply as possible:
The schema/object model contains the following:
VehicleTitle (top level element), contains an Owner, Registrant, and a
Lien. The Lien contains a LienID and a Lienholder. Owner, Registrant, and Lienholder are all the same type (Party).
So what i'm hoping to get is (more or less) are classes representing VehicleTitle, Party, Lien. With getter/setters for Owner/Registrant/Lienholder of type Party. It would seem to me that what i' m asking for are classes for only the top level elements or complex types.
However i get classes for Lienholder, Registrant, Owner (all derived from PartyType). This is problematic. In my realworld schema I have the Party Object used in many many places and can't afford to have classes generated for every element that references it.
Is there a way to acheive my objective? Different approach to the schema? If i need entries in the binding file (i've tried a few), please please somebody provide me with the simple example as it is not
clear (to me anyway) how to achieve it there.
The schema is below. I have a single top level element, and everything else is a ComplexType that can be used througout.
Is this the preferred/advisable way to define the schema to acheive the above objective?
<?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:bulk="urn:trivininc.com/bulk" targetNamespace="urn:trivininc.com/bulk"
elementFormDefault="qualified"
attributeFormDefault="unqualified"> <xsd:element name="VehicleTitle"> <xsd:complexType> <xsd:sequence> <xsd:element name="Owner" type="bulk:Party"/> <xsd:element name="Registrant" type="bulk:Party"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="Lien"> <xsd:all> <xsd:element name="LienID" type="xsd:string"/> <xsd:element name="Lienholder" type="bulk:Party"/> </xsd:all> </xsd:complexType> <xsd:complexType name="Party"> <xsd:all> <xsd:element name="LastName" type="xsd:string"/> <xsd:element name="FirstName" type="xsd:string"/> </xsd:all> </xsd:complexType> </xsd:schema>
---------------------------------------------------------------------- --
-----------------------------------------------------------
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
------------------------------------------------------------------------
----------------------------------------------------------- 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