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

Bug 348111

Summary: [Validation] @XmlElementRef validation and content assist
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: neil.hauge
Version: 3.0   
Target Milestone: 3.1 M2   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

Description Paul Fullbright CLA 2011-06-02 13:36:23 EDT
From the JAXB 2.2 spec (8.9.3.2)

- The only other additional JAXB mapping annotations allowed with @XmlElementRef are: @XmlElementWrapper and @XmlJavaTypeAdapter.
- If the collection item type or property type (for single valued property) is javax.xml.bind.JAXBElement, then {@XmlElementRef.name(),@XmlElementRef.namespace()
} must point an element factory method with an @XmlElementDecl annotation in a class annotated with @XmlRegistry (usually ObjectFactory class generated by the schema compiler) :
   a. @XmlElementDecl.name() must equal @XmlElementRef.name()
   b. @XmlElementDecl.namespace() must equal @XmlElementRef.namespace().
- If the collection item type (for collection property) or property type (for single valued property) is not javax.xml.bind.JAXBElement, then the type referenced by the property or field must be annotated with @XmlRootElement


Content assist is needed for name and namespace.
Comment 1 Paul Fullbright CLA 2011-09-21 08:40:07 EDT
Correction from:

- If the collection item type (for collection property) or property type (for
single valued property) is not javax.xml.bind.JAXBElement, then the type
referenced by the property or field must be annotated with @XmlRootElement

to:

- If the collection item type (for collection property) or property type (for
single valued property) is not javax.xml.bind.JAXBElement, then the type
referenced by the property or field must have a type *in its hierarchy* annotated with @XmlRootElement

Completed for M2