thanks for the hint. Somehow it seems to be possible to influence the source code generation with a binding file which can be specified as a command line option. I also found the schema file in the castor package. Now i'm looking for example binding.xml files. Does anyone have detailed experience on this topic? It also seems possible to force the generation of interfaces via the <interface> element. Is there any example usage which I can have a look on?
Cheers, Jens
Rhett Sutphin wrote:
Hi,
I think if you switch to using 'type' mapping you can solve your problem. http://castor.exolab.org/sourcegen.html#The-'type'-method
Rhett
Jens Saade wrote:
Hi there,
I'm using Castor version 9.4.2 in a customer project. I've got an XSD file to use with the SourceGenerator. This file must not be changed.
Problem description / scenario :
Imagine you'd have elements like ARTICLE, ARTICLE_GROUPS and INGREDIENTS. Each of those elements has a ROW element which type is different.
(XSD file see below)
What happens:
When sourcegen builds the sources - only the last ROW definition (with dependant getters/setters to ctROW_INGR) is used to build the ROW.java file. I assume that the other source files get generated as well, but are overwritten.
What I'd expect:
The Sourcegen would make an interface of the ROW element whereas the type definitions ctROW_ART, ctROW_ARTGR and ctROW_INGR implement this ROW interface.
Is it possible to force the generation of interfaces somehow for certain elements, or do the newer versions of castor do this automatically?
Remember I must not change the XSD in any way.
Thanks for help!
Cheers, Jens
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!--===================================element LNTSCALEDATA===============================-->
<xs:element name="TrsLntStd" type="ctTrsLntStd"/>
<xs:complexType name="ctTrsLntStd">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="*ARTICLE*" type="ctARTICLE"/>
<xs:element name="*ARTICLE_GROUPS*" type="ctARTICLE_GROUPS"/>
<xs:element name="*INGREDIENTS*" type="ctINGREDIENTS"/>
[...]
</xs:choice>
</xs:complexType>
<!--=================================for element ARTICLES====================================-->
<xs:complexType name="ctARTICLE">
<xs:sequence>
<xs:element name="*ROW*" type="*ctROW_ART*" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ctROW_ART">
<xs:attributeGroup ref="RowArtAttributes"/>
</xs:complexType>
<!--===================================attributes of ctROW_ART=================================-->
<xs:attributeGroup name="RowArtAttributes">
<xs:attribute name="CTRL" type="control"/>
<xs:attribute name="DEPNO" type="depno" use="required"/>
<xs:attribute name="PLUNO" type="int1to999999" use="required"/>
<xs:attribute name="UAN" type="char13"/>
<xs:attribute name="TLU" type="char100"/>
<xs:attribute name="SHORTTLU" type="char20"/>
<xs:attribute name="PRICE1" type="int0to99999999"/>
<xs:attribute name="PRICE2" type="int0to99999999"/>
<xs:attribute name="VAT1" type="int0to9"/>
<xs:attribute name="VAT2" type="int0to9"/>
<xs:attribute name="GRPNO" type="int0to9999"/>
<xs:attribute name="TARENO" type="int0to99"/>
<xs:attribute name="ARTFLAG" type="int0to99999"/>
<xs:attribute name="COMPTEXTNO" type="int0to9999"/>
<xs:attribute name="FOODVALUE" type="int0to99999"/>
<xs:attribute name="FIXWEIGHT" type="int0to999999999"/>
<xs:attribute name="DATETIME" type="date"/>
</xs:attributeGroup>
<!--================================for element ARTICLE_GROUPS==========================-->
<xs:complexType name="ctARTICLE_GROUPS">
<xs:sequence>
<xs:element name="*ROW*" type="*ctROW_ARTGR*" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ctROW_ARTGR">
<xs:attribute name="CTRL" type="control"/>
<xs:attribute name="DEPNO" type="depno" use="required"/>
<xs:attribute name="GRPNO" type="int1to99999" use="required"/>
<xs:attribute name="VAT1" type="int0to9"/>
<xs:attribute name="VAT2" type="int0to9"/>
<xs:attribute name="TEXT" type="char20"/>
</xs:complexType>
<!--================================for element INGREDIENTS==============================-->
<xs:complexType name="ctINGREDIENTS">
<xs:sequence>
<xs:element name="*ROW*" type="*ctROW_INGR*" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ctROW_INGR">
<xs:attribute name="CTRL" type="control"/>
<xs:attribute name="DEPNO" type="depno" use="required"/>
<xs:attribute name="PLUNO" type="int1to999999" use="required"/>
<xs:attribute name="RECIPENO" type="int0to9" use="required"/>
<xs:attribute name="RECIPENAME" type="char20"/>
<xs:attribute name="INGREDIENT" type="char1000"/>
</xs:complexType>
[...] </xs: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
--
PIRONET NDH AG
Jens Saade - Application Developer - Business Center Industry
Maarweg 149-161, 50825 Cologne - Germany
Phone: +49 (0)221-770-1794 - Fax: +49 (0)221-77 1005
Mail to: [EMAIL PROTECTED] - http://www.pironet-ndh.com
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
