JiBX
  1. JiBX
  2. JIBX-151

Collection which contains a to-be-ignored structure does not work correctly

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: JiBX 1.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      I am using JiBX with JDK 1.4 on Windows XP with Eclipse in an JBOSS environment.
    • Number of attachments :
      0

      Description

      I defined my own unmarshaller to translate code-elments like <code>DE</code> into existing objects read from my database. The problem occurs when i try to unmarshall a collection of such objects:

      Binding:
      <collection set-method="setNationalities" item-type="customizing.Country" factory="io.XMLBindingUtils.factorySet">
      <structure name="citizenship">
      <structure name="code" type="customizing.Country"
      unmarshaller="io.CustomizingDataUnmarshaller"/>
      </structure>
      </collection>

      XML-file snipet:
      <citizenship>
      <code>US</code>
      </citizenship>
      <citizenship>
      <code>DE</code>
      </citizenship>

      This code should create a Set of Country objects and call setNationalities to store the set in my object.
      However setNationaties is always called with an empty Set. If remove the tag <citizenship> from XML-file and from the binding it works (see below) ! Note, that my unmarshaller works correctly. It finds and returns Country-Objects as expected but the add-method of the Set is called with an java.lang.object instead of a customizing.Country object.

      Binding:
      <collection set-method="setNationalities" item-type="customizing.Country" factory="io.XMLBindingUtils.factorySet">
      <structure name="code" type="customizing.Country"
      unmarshaller="io.CustomizingDataUnmarshaller"/>
      </collection>

      XML-file snipet:
      <code>US</code>
      <code>DE</code>

      This seems to be a bug. I hope you can tell me a workaround. Is there any other way to ignore the citizenship tag ?

        Activity

        Hide
        Dennis Sosnoski added a comment -

        This is a bug, but I'm considering it a minor one since you can easily change your unmarshaller code to handle the <citizenship> wrapper element as well as the <code> element. Considering that there's a workaround, I probably won't fix this until the 2.0 rewrite of the code generation.

        Show
        Dennis Sosnoski added a comment - This is a bug, but I'm considering it a minor one since you can easily change your unmarshaller code to handle the <citizenship> wrapper element as well as the <code> element. Considering that there's a workaround, I probably won't fix this until the 2.0 rewrite of the code generation.

          People

          • Assignee:
            Dennis Sosnoski
            Reporter:
            J. Witzel
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: