Community
Participate
Working Groups
The following example: public class Foo { @XmlMixed public List content; } can not be captured as it exists in an oxm file. It does not capture wild card (@XmlAnyElement) or other (@XmlElementRef) content, so it cannot be mapped as either xml-any-element or xml-ref(s).
Further Investigation: From all documentation I can find, it seems that @XmlMixed is always meant to be used in conjunction with @XmlElementRef, @XmlElementRefs or @XmlAnyElement. We're still trying to determine if @XmlMixed by itself is a valid use case. The RI does support marshalling but does not seem to be able to unmarshal: Marshal: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <foo>First Second Third</foo> Unmarshal: Exception in thread "main" javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"#document"). Expected elements are <{}foo> EclipseLink does support marshalling and unmarshalling, but on the unmarshal we are concatenating all of the values together: Marshal: <?xml version="1.0" encoding="UTF-8"?> <foo>FirstSecondThird</foo> Unmarshal: [FirstSecondThird]
Created attachment 200218 [details] Test Case
If it turns out to not be a valid use case (I couldn't find documentation that said either way for certain) then that's also a great resolution to this. This was the origination of my investigation into the matter: http://www.eclipse.org/forums/index.php?t=rview&goto=692985#msg_692985 Seemed to imply that @XmlMixed *was* valid by itself.
One comment and one question: > <?xml version="1.0" encoding="UTF-8" standalone="yes"?> > <foo>First Second Third</foo> I'd expect the above to unmarshall as one text node, since there are no intervening other nodes. Would that make sense? In addition, what if anything would the following mean? @XmlMixed List foo; It could either: - default to @XmlElement, and ignore the @XmlMixed annotation. - default to @XmlAnyElement, taking the @XmlMixed annotation. - default to nothing, or an error. - ... ?
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink