#118 Dozer vs. XmlBeans generated primitive types

closed
None
5
2007-09-27
2007-07-31
No

Hi,

We use Dozer with XML Beans for converting XML documents (in a format of which we do not control the schema) to the DTO's required by our system.

This, for the most part, has worked out very well. We came across an issue (and it is an XmlBean'ism) with certain base xs:types.

Types such as xs:int and xs:boolean are generated by XML Beans as java primitives. See http://xmlbeans.apache.org/docs/2.0.0/guide/conXMLBeansSupportBuiltInSchemaTypes.html for some more info.

This means that when we map from the XML Beans, Dozer cannot tell the difference between the case that the value happens to be the default for the primitive (eg 0 for an int) or the element is not actually present.

XML Beans does generate an isSetXxxx method for every field.

Would it be possible to have Dozer check this method where it is provided and return null rather than the int value?

I've included some sample code and testcases below that seems to do the trick.

Cheers,

Stuntmunkee.

Updated net.sf.dozer.util.mapping.propertydescriptor.PropertyDescriptorFactory.....

Note the use of XmlBeanPropertyDescriptor

Discussion

  • Franz Garsombke

    Franz Garsombke - 2007-08-01

    Logged In: YES
    user_id=550744
    Originator: YES

    This is fixed on current_release branch and will be released with 4.1.

     
  • Franz Garsombke

    Franz Garsombke - 2007-08-01
    • status: open --> pending
     
  • SourceForge Robot

    • status: pending --> closed
     
  • SourceForge Robot

    Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 45 days (the time period specified by
    the administrator of this Tracker).

     
  • Franz Garsombke

    Franz Garsombke - 2007-09-16
    • status: closed --> pending
     
  • Franz Garsombke

    Franz Garsombke - 2007-09-27
    • status: pending --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks