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

Bug 313566

Summary: JAXB Externalized Metadata: Schema gen incorrect for XmlAnyAttribute containing xml-path without namespace
Product: z_Archived Reporter: David McCann <david.mccann>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 308677    
Attachments:
Description Flags
Contains proposed fix and test case mods none

Description David McCann CLA 2010-05-19 12:18:43 EDT
The schema gen for an XmlAnyAttribute with a non-namespace qualified xml-path is not working correctly.  The 'any' is being applied to the second last path element, as opposed to the last one.  For example, the following:

<xml-any-attribute java-attribute="stuff" xml-path="read-only/stuff" />

Should result in:

...
<xsd:element name="read-only">
  <xsd:complexType>
    <xsd:sequence>
      <xsd:element name="stuff">
        <xsd:complexType>
          <xsd:anyAttribute processContents="skip" namespace="##other"/>
        </xsd:complexType>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>
</xsd:element>
...

But currently we get:

...
<xsd:element name="read-only">
  <xsd:complexType>
    <xsd:anyAttribute processContents="skip" namespace="##other"/>
  </xsd:complexType>
</xsd:element>
...
Comment 1 David McCann CLA 2010-05-19 13:20:00 EDT
Created attachment 169157 [details]
Contains proposed fix and test case mods

Modified SchemaGenerator such that if we are dealing with an 'any' we process the last path fragment, which is the one the 'any' will be applied to.

Added 2 XSD files with xml-path info for testing.

Modified AnyAttributeTests to validate against the exisgin and new XSD files to verify the last path element is being processed correctly.
Comment 2 David McCann CLA 2010-05-19 14:37:20 EDT
Reviewed by:  matt.macivor@oracle.com
Tests: unit tests pass as expected; AnyAttributeMappingTestCases
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:14:44 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:31:01 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink