Castor generates BigDecimal for integer type in xsd
I am using an xsd schema, for example:
<xsd:element name="TrxIdRs" type="TrxIdRs_Type"/>
<xsd:complexType name="TrxIdRs_Type">
<xsd:simpleContent>
<xsd:extension base="xsd:int">
<xsd:attribute ref="trxStatusCode" use="required"/>
<xsd:attribute ref="trxStatusDescr" use="required"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:attribute name="trxStatusCode" type="xsd:int"/>
<xsd:attribute name="trxStatusDescr" type="xsd:string"/>
means XML as:
<TrxIdRs trxStatusCode="1" trxStatusDescr="descr">
111000111
</TrxIdRs>
But Castor only generates the BigDecimal type for this schema:
public abstract class TrxIdRs_Type implements java.io.Serializable {
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* internal content storage
*/
private java.math.BigDecimal _content;
/**
* Field _trxStatusCode.
*/
private java.lang.Integer _trxStatusCode;
Are there any other options for writing xsd or configure castor to have a primitive type in the generated bean?
+3
source to share
1 answer
From http://castor.codehaus.org/1.2/srcgen-example.html
The decimal schema type maps to java.math.BigDecimal.
You have to use external bindings .. there is a setup guide on this link (page 7).
+1
source to share