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

Bug 348288

Summary: [Validation] @XmlValue validation
Product: [WebTools] Dali JPA Tools Reporter: Paul Fullbright <paul.fullbright>
Component: JAXBAssignee: Paul Fullbright <paul.fullbright>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: karenfbutzke, neil.hauge
Version: 3.0Keywords: plan
Target Milestone: 3.2 M5   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

Description Paul Fullbright CLA 2011-06-03 17:37:05 EDT
From the JAXB 2.2 spec (8.9.10.2)

- At most one field or a property in a class can be annotated with @XmlValue.
- @XmlValue can be used with the following annotations:
    - @XmlList - however this is redundant since @XmlList maps a type to a schema simple type that derives by list just as @XmlValue would.
    - @XmlJavaTypeAdapter
- If the type of the field or property is a collection type, then the collection item type must map to a simple schema type. Examples:
// Examples (not exhaustive): Legal usage of @XmlValue
@XmlValue List<Integer> foo; // int maps to xs:int
@XmlValue String[] foo; // String maps to xs:string
@XmlValue List<Bar> foo; // only if Bar maps to a simple
// schema type
- If the type of the field or property is not a collection type, then the type
of the property or field must map to a schema simple type.
- The containing class must not extend another class (other than
java.lang.Obect).

Also: 
- The java type containing the @XmlValue must map to a type with text content.
- If the java attribute type is a collection type, then the schema type must be a list simple type  [ More investigation needed here ]
Comment 1 Paul Fullbright CLA 2011-11-16 12:11:17 EST

*** This bug has been marked as a duplicate of bug 336393 ***
Comment 2 Paul Fullbright CLA 2011-11-16 12:14:34 EST
changing dependency direction
Comment 3 Paul Fullbright CLA 2011-11-16 12:15:02 EST
*** Bug 336393 has been marked as a duplicate of this bug. ***
Comment 4 Paul Fullbright CLA 2011-11-16 12:46:31 EST
As of 3.1 the following has been implemented:

- At most one field or a property in a class can be annotated with @XmlValue.
- XmlValue can be used with the following annotations: XmlList, XmlJavaTypeAdapter, (and actually XmlSchemaType, though our invalidation fails)

The rest is as of yet unimplemented.
Comment 5 Paul Fullbright CLA 2012-03-19 12:35:38 EDT
The remaining validation tests were implemented for M5.