Castor User Community:

We have used the Castor SourceGenerator for some time with the same Schema.xsd, castorbuilder.properties, and command-line options from at least Castor 0.9.3.19 through 0.9.5.3. In the process of upgrading from 0.9.5.3 to 0.9.6, however, the resulting source code for one of the elements in our schema has changed dramatically.

Specifically, we define a processType. In the generated ProcessTypeChoice.java file, we previously found a method getProcessTypeChoiceItem() that returned a single ProcessTypeChoiceItem.
Under Castor 0.9.6, however, the getProcessTypeChioceItem() method now returns a array: ProcessTypeChoiceItem[].


I've got a suspicion that something has changed in the way that our definition of processType is interpreted or maybe we used to rely on a default castorbuilder.properties definition or default xsd syntax that must now be explicitly declared. I can't find the difference in any change logs or on the new Codehaus archive or in the SourceGenerator user documents. While I fear that this has already been discussed on the castor.exolab.org archive ... I can't check that at the moment.

Our xsd definition of the processType is:

<xsd:complexType name="processType">
<xsd:sequence>
<xsd:element name="comment" type="descriptionType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="parentId" type="idType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="description" type="descriptionType" />
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="inputInt" type="inputTupleIntType"/>
<xsd:element name="inputFloat" type="inputTupleFloatType"/>
<xsd:element name="inputString" type="inputTupleStringType"/>
<xsd:element name="inputBoolean" type="inputTupleBooleanType"/>
<xsd:element name="inputChoice" type="inputTupleChoiceType">
<xsd:unique name="choiceIdUnique">
<xsd:selector xpath="choice"/>
<xsd:field xpath="@id"/>
</xsd:unique>
<xsd:key name="choiceIdKey">
<xsd:selector xpath="choice"/>
<xsd:field xpath="@id"/>
</xsd:key>
</xsd:element>
</xsd:choice>
</xsd:sequence>
<xsd:attribute name="id" type="idType" use="required" />
</xsd:complexType>


Our castorbuilder.properties file is all defaults, except for defining a superclass:
#org.exolab.castor.builder.boundproperties=true
#org.exolab.castor.builder.javaclassmapping=element
org.exolab.castor.builder.superclass=org.opencoral.util.RmXMLFather
#org.exolab.castor.builder.nspackages=\
http://www.xyz.com/schemas/project=com.xyz.schemas.project,\
http://www.xyz.com/schemas/person=com.xyz.schemas.person
#org.exolab.castor.builder.equalsmethod=true
#org.exolab.castor.builder.primitivetowrapper=false
#org.exolab.castor.builder.classdescfieldnames=false
#org.exolab.castor.builder.extraCollectionMethods=true
#org.exolab.castor.xml.JavaNaming.upperCaseAfterUnderscore=true


Finally, we call org.exolab.castor.builder.SourceGenerator with the "-types j2" flag.

At this point, I'm unable to see what I need to change or add in order to get Castor 0.9.6 to return a single ProcessTypeChoiceItem instead of a ProcessTypeChoiceItem[] for the getProcessTypeChoiceItem() method.

Any insights would be greatly appreciated,

Thanks,

John Shott

Reply via email to