On Mon, Nov 26, 2012 at 11:59 PM, Marc CARRÉ <carre.marc_at_gmail.com> wrote:
> Hi Tatu,
>
> I have attached some sources to easily reproduce the issues I'm facing.
> It is now a bit different from the original problem since I abstracted
> Jersey away, for more simplicity.
>
> If you comment out Woodstox in the POM, you will be able to see these
> "weird" namespaces.
> They seem valid from a XML standard perspective, but extremely verbose and
> difficult to read, e.g. :
>
> <ArrayList>
> <zdef-1574603151:id
> xmlns:zdef-1574603151="http://wwww.example.com/schema.xsd">ABC</zdef-1574603151:id>
> <zdef-1185908088:date
> xmlns:zdef-1185908088="http://wwww.example.com/schema.xsd">2012-11-23</zdef-1185908088:date>
> <zdef-1530804123:timestamp
> xmlns:zdef-1530804123="http://wwww.example.com/schema.xsd">2012-11-27T06:10:03Z</zdef-1530804123:timestamp>
> <zdef-1738378334:binary
> xmlns:zdef-1738378334="http://wwww.example.com/schema.xsd">AQ==</zdef-1738378334:binary>
> </ArrayList>
That is very odd. By default, Woodstox should use different prefix
names ("wstxns" if my memory serves), and while it does try to add
unique numeric prefix (when it must), these do not look like something
it'd use. You can actually configure prefix used as well.
>
>
> If you add Woodstox back, you would see the exceptions again:
> Unexpected IOException (of type java.io.IOException):
> javax.xml.stream.XMLStreamException: Trying to output second root,
> <ArrayList>
Yes -- this may be because List serializer is not modified for root
values, as it is not invoked by BeanSerializer.
This is the thing for which we need Jackson 2.2 improvements, which
would make this case work as well (and hopefully make others work more
reliably).
> In the attached sources, I use the JAXB maven plugin to generate the classes
> from src/main/resources/schema.xsd.
> There are also some "tweaks" using additional information in the schema and
> using *.xjb files, especially for the formatting of Joda DateTime.
Ok. Those are probably ignored by Jackson, FWIW.
>
> More importantly, the unit tests show the expected/desired output.
> e.g.
> - ["ABC","DEF"] V.S. {"id":["ABC","DEF"]}
> - insertion of empty namespaces for some reason
>
> I hope this helps.
It should, once I get back to working on 2.2 XML module. I started
working on databind interface to allow rewrite (extending
Bean(De)SerializerModifier to work for all (de)serializer types, not
just Bean(De)Serializer), and that should get done relatively soon.
But then the rewrite of xml module (wrt Collection type handling) is
bit more involved.
-+ Tatu +-