History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: CASTOR-2222
Type: Bug Bug
Status: Closed Closed
Resolution: Incomplete
Priority: Critical Critical
Assignee: Werner Guttmann
Reporter: aparajitha
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
castor

issue with generated castor mapping file when nested choice is used for castor.

Created: 06/Dec/07 03:32 AM   Updated: 14/Mar/08 06:41 AM
Component/s: XML code generator
Affects Version/s: None
Fix Version/s: 1.2

Time Tracking:
Issue & Sub-Tasks
Issue Only
Not Specified

File Attachments: 1. Text File Customers_V2 0 2.xsd (306 kb)
2. XML File mapping.xml (278 kb)


Sub-Tasks  All   Open   

 Description  « Hide
Hi
i have used castor maven plugin 2.0-alpha1 to generate the classes for the xsd. Using the generated classes i have generated mapping file from mapping tool.
In my xsd...
<xs:complexType name="AffiliationType">
<xs:sequence>
<xs:element name="Name" type="xs:string" minOccurs="0"/>
<xs:element name="Description" type="xs:string" minOccurs="0"/>
<xs:element name="Relationship" type="xs:string" minOccurs="0"/>
<xs:element name="AffiliationType" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:choice maxOccurs="unbounded">
<xs:element name="RetailStoreID" type="xs:string"/>
<xs:element name="PartyID" type="xs:string"/>
<xs:element name="CustomerID" type="xs:string"/>
</xs:choice>
</xs:sequence>
<xs:attribute name="Action" type="AffiliationActionType"/>
<xs:attribute name="UpdateType" type="CustomerUpdateType" use="optional" default="Existing"/>
<xs:attribute name="PrimaryFlag" type="xs:boolean" use="optional" default="true"/>
</xs:complexType>

the classes with respect to nested choice are generated properly. But in the mapping file for the corresponding element (AffiliationTypeChoice) "error-if-this-is-used" is mapped.

<bind-xml name="AffiliationType" node="element"/>
<field name="affiliationTypeChoice" type="com.wsgc.blueprint.phase0.prototype.atp.schema.AffiliationTypeChoice" required="true"><bind-xml name<b>="error-if-this-is-used" </b>node="element"/>
</field></class>

i have attached mapping file and xsd for your refernce.

need ur help soon

thanks in advance
aparvatala



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Werner Guttmann - 06/Dec/07 05:05 AM - edited
Why are you using a mapping file at all when you generate classes with the Castor source generator ?

aparajitha - 06/Dec/07 07:07 AM
without mapping file , marshalling works but not unmarshalling.
while unmarshalling, it searches for the corresponding class for root of the xml. If mapping file is not provided it raises an exception.
That's the reason for me to use mapping file

Werner Guttmann - 10/Dec/07 03:56 PM
That's - in my humble opinion - a complete mis-usage of Castor. Can you show me how you are using the Unmarshaller (in code), and what kind of exception are you getting ?

Werner Guttmann - 10/Dec/07 03:58 PM
WHen you generate classes from an XML schema, Castor - in addition to the Java entity classes - will generate descriptor classes. These classes carry all the information to map between XML artifacts and Java classes, incl. namespaces, names, etc.

Werner Guttmann - 11/Dec/07 03:03 AM
Question: are you using Castor for the first time, or have you been using Castor for e.g. months and are you facing a particular problem ? If you happen to be a first time user, please do consider subscribing to e.g. the user mailing list, and have a look at the archives as well.

Werner Guttmann - 27/Dec/07 04:57 PM
As explained above, generating classes from an XML schema and using a mapping file at the same time just ... well, does not make any sense.