JiBX
  1. JiBX
  2. JIBX-147

Regression in compiling bindings for same element name in different namespace

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JiBX 1.1, JiBX 1.1.2
    • Fix Version/s: JiBX 1.1.5
    • Component/s: core
    • Labels:
      None
    • Environment:
      Ubuntu 6.06, Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)

      I don't think it's an environment issue.
    • Testcase included:
      yes
    • Number of attachments :
      2

      Description

      There seems to be a bug introduced at some point between 1.0 RC1 and 1.1 / CVS HEAD.

      The attached contains a patch made against CVS HEAD as of 2006-12-02 22:00 GMT which contains changes which demonstrate this issue (namespace-binding-issue-patch-20061202-2250.txt). This patch contains a new binding.xml, associated bean classes and adds the binding.xml into the project build. This 'test' only demonstrates the issue with the binding, but I have similar production code bindings which work with 1.0 RC1 both from a binding perspective and being able to marshal the XML correctly as well.

      I have also tried putting these changes into a separate project / build and building that against JiBX 1.0 RC1 and 1.1 and HEAD. The latter all fail again. (namespace-binding.zip). This was done to confirm that the simplified form of the test derived from my production bindings was a correct demonstration of the issue.

      I will be trying to create a patch that fixes this as well, but my lack of familiarity with the codebase will probably make that slow work for now.

        Activity

        Hide
        James Abley added a comment -

        Revised binding appears to work, which declares the namespaces at the top of the binding, rather than just implicitly declaring them when they become the default namespace inside the mapping.

        <?xml version="1.0" encoding="UTF-8"?>
        <binding>
        <namespace uri="http://www.jibx.com/xmlns/device-hierarchy" prefix="dh"/>
        <namespace uri="http://www.jibx.com/xmlns/device" prefix="d"/>
        <mapping name="device" class="multiple.DeviceHierarchyBean"
        ns="http://www.jibx.com/xmlns/device-hierarchy">
        <namespace uri="http://www.jibx.com/xmlns/device-hierarchy" default="elements"/>
        <value name="parent" field="parent" usage="required" style="attribute"/>
        </mapping>
        <mapping name="device" class="multiple.DeviceBean" ns="http://www.jibx.com/xmlns/device">
        <namespace uri="http://www.jibx.com/xmlns/device" default="elements"/>
        <value name="name" field="name" usage="required" style="attribute"/>
        </mapping>
        </binding>

        Presumably this is the recommended approach generally, and the behaviour has been tightened up between 1.0 RC1 and 1.1 / HEAD? This would seem to fix my problem. I would still be keen to see the test case integrated into the main trunk in some form. Is there anything I can do to help with this?

        Cheers,

        James

        Show
        James Abley added a comment - Revised binding appears to work, which declares the namespaces at the top of the binding, rather than just implicitly declaring them when they become the default namespace inside the mapping. <?xml version="1.0" encoding="UTF-8"?> <binding> <namespace uri="http://www.jibx.com/xmlns/device-hierarchy" prefix="dh"/> <namespace uri="http://www.jibx.com/xmlns/device" prefix="d"/> <mapping name="device" class="multiple.DeviceHierarchyBean" ns="http://www.jibx.com/xmlns/device-hierarchy"> <namespace uri="http://www.jibx.com/xmlns/device-hierarchy" default="elements"/> <value name="parent" field="parent" usage="required" style="attribute"/> </mapping> <mapping name="device" class="multiple.DeviceBean" ns="http://www.jibx.com/xmlns/device"> <namespace uri="http://www.jibx.com/xmlns/device" default="elements"/> <value name="name" field="name" usage="required" style="attribute"/> </mapping> </binding> Presumably this is the recommended approach generally, and the behaviour has been tightened up between 1.0 RC1 and 1.1 / HEAD? This would seem to fix my problem. I would still be keen to see the test case integrated into the main trunk in some form. Is there anything I can do to help with this? Cheers, James
        Dennis Sosnoski made changes -
        Field Original Value New Value
        Assignee Dennis Sosnoski [ dsosnoski ]
        Hide
        Dennis Sosnoski added a comment -

        The validation code wasn't properly assigning namespaces to mappings, partially because of an order issue where the namespaces weren't set until the validation pass - which occurs after the registration pass where the names are checked.

        Show
        Dennis Sosnoski added a comment - The validation code wasn't properly assigning namespaces to mappings, partially because of an order issue where the namespaces weren't set until the validation pass - which occurs after the registration pass where the names are checked.
        Dennis Sosnoski made changes -
        Fix Version/s JiBX 1.1.5 [ 13506 ]
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Dennis Sosnoski made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Dennis Sosnoski made changes -
        Component/s core [ 10676 ]
        Component/s Generator Tools [ 11490 ]

          People

          • Assignee:
            Dennis Sosnoski
            Reporter:
            James Abley
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: