Community
Participate
Working Groups
Given the following object: @XmlRootElement public class Employee { @XmlAnyElement public Object[] anyObjects; } The JAXB RI will generate an unbounded <any> element, but EclipseLink does not. JAXB Context: class com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl [<?xml version="1.0" standalone="yes"?> <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="employee" type="employee"/> <xs:complexType name="employee"> <xs:sequence> <xs:element name="first-name" type="xs:string" minOccurs="0"/> <xs:element name="last-name" type="xs:string" minOccurs="0"/> <xs:element name="bigBytes" type="xs:byte" nillable="true" minOccurs="0" maxOccurs="unbounded"/> <xs:any processContents="skip" namespace="##other" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="id" type="xs:int" use="required"/> </xs:complexType> </xs:schema> ] JAXB Context: class org.eclipse.persistence.jaxb.JAXBContext [<?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:complexType name="employee"> <xsd:sequence> <xsd:element name="first-name" type="xsd:string" minOccurs="0"/> <xsd:element name="last-name" type="xsd:string" minOccurs="0"/> <xsd:any processContents="skip" namespace="##other"/> </xsd:sequence> <xsd:attribute name="id" type="xsd:int" use="required"/> </xsd:complexType> <xsd:element name="employee" type="employee"/> </xsd:schema> ] <?xml version="1.0" encoding="UTF-8"?> <employee id="1221"> <first-name>Dan</first-name> <last-name>Savage</last-name> </employee> This results in the following schema validation error: ERROR cvc-complex-type.2.4.b: The content of element 'employee' is not complete. One of '{WC[##other:""]}' is expected.
Note that the difference only occurs when the XmlAnyElement in on an array. When it is specified on a List<Object> both implementations behave the same and there is a minOccurs=0 specified.
Created attachment 196676 [details] Proposed changes and test
Checked in changes to Schema Generation as well as fixing the Mappings generator to properly handle the Object[] case.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink