JiBX
  1. JiBX
  2. JIBX-64

Namespace Index Incorrect for custom marshallers

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Cannot Reproduce
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core
    • Labels:
      None
    • Number of attachments :
      0

      Description

      When a binding file contains custom marshaller and unmarshaller for a particular mapping in a specific namespace, the following is required:

      1) The namespace must be declared globally, because
      2) mappings with custom (un)marshallers cannot have child elements.

      When the binding file contains mappings with these custom (un)marshallers, the generated code passes an index of 0 to the custom marshalling class's constructor.

      Interestingly, if the mapping with the custom (un)marshallers is referenced in other mappings that do not use custom (un)marshallers, then the proper index for the namespace will be passed.

      For instance,

      <binding>
      <namespace uri="ns:a" default="elements"/>
      <mapping name="a" class="AClass" unmarshaller="AMapper" marshaller="AMapper" ns="ns:a"/>
      </binding>

      The generated code for the above binding file should pass index 2 to AMapper's constructor. However, it does not.

      In the following binding file,

      <binding>
      <namespace uri="ns:a" default="elements"/>
      <mapping name="a" class="AClass" unmarshaller="AMapper" marshaller="AMapper" ns="ns:a"/>
      <mapping name="b" class="BClass">
      <structure field="a" usage="optional"/>
      </mapping>
      </binding>

      When the custom mapping (a) is referenced in another mapping, then this will produce the proper code. The generated class will pass an index of 2 to AClass' constructor.

      I am not entirely sure if this is the intended behavior. If not, then this issue can be closed.

      Thanks,
      Chris

        Activity

        Hide
        Dennis Sosnoski added a comment -

        I've added a test case for the actual error part of this (Namespace Index Incorrect for custom marshallers) and haven't been able to reproduce the problem. The test case is in CVS as build/test/extras/binding9.xml, so you can try it for yourself.

        The need for a global namespace declaration is somewhat awkward, but is the intended behavior. I'll look at a cleaner approach for 2.0.

        Show
        Dennis Sosnoski added a comment - I've added a test case for the actual error part of this (Namespace Index Incorrect for custom marshallers) and haven't been able to reproduce the problem. The test case is in CVS as build/test/extras/binding9.xml, so you can try it for yourself. The need for a global namespace declaration is somewhat awkward, but is the intended behavior. I'll look at a cleaner approach for 2.0.

          People

          • Assignee:
            Dennis Sosnoski
            Reporter:
            Chris Chen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: