Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 332250 - Marshalling node with no namespace should clear default namespace if necessary
Summary: Marshalling node with no namespace should clear default namespace if necessary
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-09 16:01 EST by Blaise Doughan CLA
Modified: 2022-06-09 10:22 EDT (History)
1 user (show)

See Also:


Attachments
MOXy - Test Cases (11.62 KB, patch)
2010-12-14 11:53 EST, Blaise Doughan CLA
no flags Details | Diff
Core - Fix (9.56 KB, patch)
2010-12-14 11:53 EST, Blaise Doughan CLA
no flags Details | Diff
Core - Fix (to address SDO test failures) (643 bytes, patch)
2010-12-16 11:09 EST, Blaise Doughan CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Blaise Doughan CLA 2010-12-09 16:01:56 EST
If a node value is being marshalled that is not namespace qualified, if it is being written to an XML document with a default namespace declaration then it should clear it:

If:

    <bar>Hello World</bar>

Is being marshalled into the following doc:

   <foo xmlns="urn:foo">
   </foo>

Then the result should be:

   <foo xmlns="urn:foo">
       <bar xmlns="">Hello World</bar>
   </foo>
Comment 1 Blaise Doughan CLA 2010-12-14 11:53:03 EST
Created attachment 185148 [details]
MOXy - Test Cases
Comment 2 Blaise Doughan CLA 2010-12-14 11:53:18 EST
Created attachment 185149 [details]
Core - Fix
Comment 3 Blaise Doughan CLA 2010-12-14 13:39:14 EST
DOMReader
- In getQName(Element), the handlePrefixedAttribute(Element) method is now called even if the element does not have a prefix.  This is to handle the default namespace use case

DomToXMLEventWriter
- Needed to get the default namespace before the element was created.  This is because if the element was created in the default namespace it would blow aware what the default namespace had previously been.

XMLFragmentReader
- Guard against a null NamspaceResolver being passed to the constructor
- When resolving a namespace, the default namespace on the NamespaceResolver is also checked.

NamespaceResolver
- If the prefix passed to the put operation is null/"", set the uri as the default namespace on the NamespaceResolver.

NodeRecord
- When performing startPrefixMappings recognize that you may need to declare the default namespace as no namespace "".

OutputStreamRecord/WriterRecord
- If the prefix is null/"" and there is no namespace URI then declare the "" namespace.

SAXDocumentBuilder
- If the prefix or URI are null, convert then to "".
Comment 4 Blaise Doughan CLA 2010-12-14 16:53:04 EST
Fix checked into trunk at rev: 8708

Code reviewed by:  Matt MacIvor
Comment 5 Blaise Doughan CLA 2010-12-16 11:09:39 EST
Created attachment 185343 [details]
Core - Fix (to address SDO test failures)
Comment 6 Eclipse Webmaster CLA 2022-06-09 10:22:29 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink