users@jersey.java.net

Re: [Jersey] XML Schema, JSON arrays and java List<String>

From: Robert Koberg <rob.koberg_at_gmail.com>
Date: Mon, 3 Aug 2009 10:05:16 -0700

FWIW, this is the closest I can get with a straight schema:


   <xs:complexType name="MessageKeysType">
     <xs:sequence>
       <xs:element name="msg-key" type="xs:string"
maxOccurs="unbounded"/>
     </xs:sequence>
   </xs:complexType>

   <xs:complexType name="ResponseType">
     <xs:sequence>
       <xs:element name="message-keys" type="MessageKeysType"
minOccurs="0"/>
     </xs:sequence>
   </xs:complexType>

   <xs:element name="response" type="ResponseType"/>

produces:

{"message-keys":{"msg-key":["input.incorrect","foo","bar"]}}

Any tricks I am missing to remove the need for the msg-key property?

thanks,
-Rob



On Aug 2, 2009, at 2:29 PM, Robert Koberg wrote:

> Hi,
>
> Is there a way to create an XML Schema so that the JAXB/Jersey JSON
> Response produces an array and the XML response produces data
> elements, e.g.
>
> {
> "message-keys": [
> "a.b",
> "c.d"
> ]
> }
>
> and
>
> <message-keys>
> <entry>a.b</entry>
> <entry>c.d</entry>
> </message-keys>
>
> Everything I am trying is giving me a space separated value.
>
> thanks for any help/hints,