users@jersey.java.net

Re: [Jersey] XSL transform annotation and message body reader/writer

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Sun, 29 Nov 2009 18:19:19 -0800

On Sun, Nov 29, 2009 at 8:33 AM, Robert Koberg <rob.koberg_at_gmail.com> wrote:
>
> On Nov 27, 2009, at 11:46 PM, Tatu Saloranta wrote:
...
>> So just pipe in stream into XSL processor, which will use whatever is
>> fastest way (Saxon builds its own TinyTree, Xalan probably something
>> similar).
>
> That makes sense. So, as you read the stream of JSON events you emit the corresponding XML event. I remember discussing this a while ago on the Jackson list. Is there anything in Jackson that will make this process simple? :) Perhaps something like a JSONSource (implements javax.xml.transform.Source)?

Not yet, although there are Jira issues for possible things (like
exposing JSON content as trivially translated SAX events). But
generally Jackson focuses on 'pure' JSON aspects, so most XML features
are for minimal interoperability. So for XSL Jackson might not help a
lot. XSL is for XML.

That's also why javax.xml.transform Source/Result is an edge case: it
is named to suggest it's just for XML (not JSON). But functionality
contained is fairly generic, mostly just input/output objects, and
public/system id (which are generic references too). So I am not sure
if JSONSource/Result would make sense or not.

I would think that reusable XSL filter would be useful for others, at any rate.

-+ Tatu +-