users@jersey.java.net

Re: [Jersey] Problem unmarshalling json with XSD using elementformdefault=qualified

From: Jakub Podlesak <Jakub.Podlesak_at_Sun.COM>
Date: Fri, 20 Nov 2009 15:12:34 +0100

On Fri, Nov 20, 2009 at 03:02:26PM +0100, Jakub Podlesak wrote:
>
> Hi David,
>
> Sorry for late response,
>
> On Wed, Nov 18, 2009 at 05:49:45PM -0700, David Johnson wrote:
> > Hi Jakub,
> >
> > Could you update me on the status of XML namespace support in JSON
> > natural?
>
> in natural notation, namespaces should be supported (well, besides edge cases
> like xs:any, xs:anyAttribute, ...) so that the information on namespace


correction:

s/so that/but/

the trick is, that when deserializing, JAXB provides some hints to Jersey
on what is expected next, and Jersey makes up the namespace information
based on the hints. It is obvious why this does not work for the above mentioned
corner cases.

~Jakub

> is not being propagated into the generated JSON. Then if you want
> to deserialize such a JSON data back to JAXB, you will need to stick
> with Jersey.
>
>
> >
> > If it isn't there yet then what alternative do you recommend? E.g.
> > Mapped?
>
> In mapped notation, the support is also added. But there, the namespace uri
> will get translated into JSON data, and you need to define a mapping
> for all such URIs. Further details you can find at [1].
>
> HTH,
>
> ~Jakub
>
> [1]https://jersey.dev.java.net/nonav/documentation/latest/user-guide.html#d4e654
>
> >
> > Thanks,
> > David Johnson
> >
> >
> >
> > On May 22, 2009, at 3:18, Jakub Podlesak <Jakub.Podlesak_at_Sun.COM> wrote:
> >
> > >On Thu, May 21, 2009 at 08:27:04PM -0600, davidj_at_lynxlogic.com wrote:
> > >>I have an XSD I'm using to generate JAXB annotated java classes,
> > >>and I'm
> > >>attempting to use jersey's natural notation implementation to
> > >>unmarshal
> > >>JSON with them. If elementFormDefault on my XSD is set to
> > >>unqualified,
> > >>the JSON is correctly unmarshalled. However, if I set it to
> > >>qualified,
> > >>then only the attributes on the root element are unmarshalled; any
> > >>child
> > >>elements and their attributes are null on the unmarshalled object.
> > >>
> > >>I've looked around the source code and javadoc and there don't
> > >>appear to
> > >>be any configuration settings relating to namespace for the natural
> > >>notation. Is there a known issue with this or something I'm missing?
> > >
> > >Namespace support for Jersey internal notations is missing at the
> > >moment.
> > >I am working on adding this. For the natural notation
> > >there is a feature missing in stable JAXB RI at the moment,
> > >which will prevent this to work until the next JAXB RI version 2.1.12
> > >is available (i was told, it should be released in the late summer/
> > >early autumn).
> > >
> > >~Jakub
> > >
> > >>
> > >>Thanks,
> > >>David Johnson
> > >>
> > >>
> > >>---------------------------------------------------------------------
> > >>To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> > >>For additional commands, e-mail: users-help_at_jersey.dev.java.net
> > >>
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> > >For additional commands, e-mail: users-help_at_jersey.dev.java.net
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> > For additional commands, e-mail: users-help_at_jersey.dev.java.net
> >
>
> --
> Jakub Podlešák
> Software Engineer at SUN Microsystems And CZJUG Co-Leader
> http://blogs.sun.com/japod
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>

-- 
Jakub Podlešák
Software Engineer at SUN Microsystems And CZJUG Co-Leader
http://blogs.sun.com/japod