Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 358297

Summary: XmlAnyElement produces duplicate namespace declarations when marshalling
Product: z_Archived Reporter: Rick Barkhouse <rick.barkhouse>
Component: EclipselinkAssignee: Project Inbox <eclipselink.oxm-inbox>
Status: CLOSED INVALID QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Rick Barkhouse CLA 2011-09-20 15:50:13 EDT
Consider the following Java class / XML Bindings file:

=====

@XmlRootElement
public class CustomerAnno {
    @XmlAnyElement
    public Object anyElem;
}

=====

	<java-types>
		<java-type name="Customer">
			<xml-root-element />
			<java-attributes>
				<xml-any-element java-attribute="anyElem" />				
			</java-attributes>
		</java-type>
	</java-types>

=====

If a namespace-qualified Element is set on anyElem:

anyElem = doc.createElementNS("any-element", "my-elem");

Annotations:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customerAnno xmlns="http://www.example.org/package">
    <my-elem:my-elem xmlns:my-elem="any-element" xmlns="any-element"/>
</customerAnno>

   * Note duplicate declaration of 'any-element'

XML Bindings:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:customer xmlns:ns0="http://www.example.org/package">
   <my-elem xmlns="any-element"/>
</ns0:customer>

   * Note that this is not textually identical to the Annotations version
Comment 1 Eclipse Webmaster CLA 2022-06-09 10:04:23 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:07:28 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink