#118 Dozer vs. XmlBeans generated primitive types



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.



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

Note the use of XmlBeanPropertyDescriptor


  • Franz Garsombke

    Franz Garsombke - 2007-08-01

    Logged In: YES
    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
    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