Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 341708 - Problem adding a namespace declaration with default prefix that is already in use
Summary: Problem adding a namespace declaration with default prefix that is already in...
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Sapphire (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Konstantin Komissarchik CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-02 20:33 EDT by Konstantin Komissarchik CLA
Modified: 2021-11-19 09:21 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Komissarchik CLA 2011-04-02 20:33:32 EDT
If a namespace declaration needs to be added by its default prefix is already in use, the XML binding code doesn't handle it correctly. It either overwrites the previous definition or fails to insert the new definition in the correct location (depending on the DOM implementation).

Let's say you are starting with this document...

<y:root 
  xmlns:y="http://www.eclipse.org/sapphire/tests/xml/binding/0007/x"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</y:root>

... and you need to add element "child" with default namespace that prefers prefix "y"... you want XML binding code to resolve this problem by generating a unique prefix for the new namespace, creating a document such as this...

<y:root
  xmlns:y="http://www.eclipse.org/sapphire/tests/xml/binding/0007/x"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:y1="http://www.eclipse.org/sapphire/tests/xml/binding/0007/y">
  <y1:child>abc</y1:child>
</y:root>
Comment 1 Konstantin Komissarchik CLA 2011-04-02 20:39:03 EDT
Fixed and added corresponding unit test... TestXmlBinding0007.
Comment 2 Ling Hao CLA 2011-06-10 18:13:05 EDT
Verified in unit test.