This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes null values in castor unmarshalling Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "null values in castor unmarshalling" Watch "null values in castor unmarshalling" New topic
Author

null values in castor unmarshalling

maya fur
Greenhorn

Joined: Sep 08, 2005
Posts: 11
Hi,
I'm using castor to unmarshall xml to java objects. The only problem is that I'm not able to get null values...
In the xsd the element is nillable
<xs:element name="OC" type="xs ouble" nillable="true"/>
and in the castor mapping file I defined the type as object, not a primitive
<field name="OC" type="java.lang.Double" required="false" direct="false" transient="false">
<bind-xml name="OC" node="element" reference="false"/>
</field>
In addition, I validate using the schema to unmarshal.setValidation("true");

If my xml does not have a tag, then this is field is null. But if the tag is empty (<OC></OC> then I get a Double with value 0.
Any idea how I can get null if the tag is sent?
Thanks
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: null values in castor unmarshalling
 
Similar Threads
Problem in unmarshalling an empty list using Castor.
Castor unable to Map - please help
XML Schema : handling null values
Castor: How to map list items within a "parent" list element?
Axis generating Elements instead of Attributes