castor

AnyNode changing namespace prefix to first one encountered for sibling nodes (if the namespace uri is reused) in case of marshalling

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.1.2.1
  • Fix Version/s: 1.2
  • Component/s: XML
  • Labels:
    None
  • Environment:
    Java 1.5
  • Testcase included:
    yes
  • Patch Submitted:
    Yes
  • Number of attachments :
    2

Description

AnyNode changing namespace prefix to first one encountered for sibling nodes (if the namespace uri is reused).
If AnyNode has the following XML

<f:firstname xmlns:f="http://name.namespace">
<f:text>John</f:text>
</f:firstname>
<l:lastname xmlns:l="http://name.namespace" >
<l:text>Right</l:text>
</l:lastname>

The namespace after unmarshalling & marshalling for the second node (re-using namespace URI but a different prefix)
is changed to the namespace prefix of the first one i.e.
After an unmarshall and marshall, the resulting XML will be

<f:firstname xmlns:f="http://name.namespace">
<f:text>John</f:text>
</f:firstname>
<!-- Note the change here, the XML is invalid now -->
<f:lastname xmlns:l="http://name.namespace">
<f:text>Right</f:text>
</f:lastname>

The marshalled XML now has "f:lastName" with namespace declaration of "xml:l", resulting in INVALID XML.

Activity

Hide
Vikas Rawat added a comment -

Included
1. Testcase
2. Readme.txt
3. Unified Patch
4. Mapping / Entity / Input XMLs

Show
Vikas Rawat added a comment - Included 1. Testcase 2. Readme.txt 3. Unified Patch 4. Mapping / Entity / Input XMLs
Hide
Werner Guttmann added a comment -

Final patch for review.

Show
Werner Guttmann added a comment - Final patch for review.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
30m
Original Estimate - 30 minutes Original Estimate - 30 minutes
Remaining:
0m
Remaining Estimate - 0 minutes
Logged:
40m
Time Spent - 40 minutes