Hello Paul,
> Yes, it uses the class name of the item class. Our bad it should have used the @XmlRootElement annotation, it present and retained the case.
So, in my case it knew to turn "Person" into the plural "people" (rather then persons)?
> Here are a number of possible solutions:
>
> 1) Use the @XmlRootElement defined on the item JAXB class, or same rules to derive the name, and pluralize it (without lower casing it).
>
> 2) Annotate the resource method with @XmlRootElement (however that might interfere if the resource class is also a JAXB
> class)
>
> 3) Annotate the JAXB class with a special Jersey annotation (the same can apply for 2 as well).
>
>
> I am leaning towards option 1), unfortunately we cannot make that the default because we will break on the wire backwards compatibility. Do you have any preference or further ideas on the matter?
>
In my situation I have "Person" and a "People" element which contains 1 or more Person elements [1]. The XmlRootElement of my Person element is Person, perhaps I don't have my schema setup correctly though. But in this case using XmlRootElement would not have helped me. Using uppercase "People" would have made it work out of the box for me, but likely not everyone. I think that not lower casing it (using whatever case is there) would be a good compromise.
> In the interim there is a possible work around without having to change your application code. Implement a resource filter that modifies the entity and wraps it around an instance of Person.
Thanks. I'll check this out.
-jr
[1] my XSD for People and Person.
<xsd:element name="People">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Person" minOccurs="0" maxOccurs="unbounded"
type="Person" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Person" type="Person" />
<xsd:complexType name="Person">
<xsd:sequence>
<xsd:element name="Id" type="xsd:int" />
<xsd:element name="firstName" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>