Thank on this Jörg,
Im taking it in right now and will reply later.

On Thu, Jul 3, 2014 at 5:43 AM, Jörg Schaible <joerg.schai...@swisspost.com>
wrote:

> Hi Lewis,
>
> Lewis John Mcgibbney wrote:
>
> > Hi Folks,
> > I work on an object-to-datastore mapping framework called Apache Gora [0]
> > and recently came across XStream for simplying data modeling in Gora.
> >
> > I really like the project you guys are working on but i wonder if you can
> > answer me one question.
> >
> > Can I use only JSON e.g. as a string or FileInputStream as oppose to
> > having to pass around objects? e.g. xstream.alias("product",
> > Product.class);
> >
> > Say for example I have many Objects, or another example would be that I
> do
> > not actually have objects but I have JSON which "represents" the
> > object(s).
>
> XStream's HierarchicalStreamDriver is simply a vehicle to provide
> HierarchicalStreamReader and HierarchicalStreamWriter instances
> reading/writing the same format (encapsulating additionally underlaying
> implementations for parsers and formatters).
>
> Technically it is no problem to use those implementations independently.
> Since XStream's hierarchical stream has a unified model, it *is* possible
> to
> transform the stream from one format into the other:
>
> ==================== %< ======================
> HierarchicalStreamReader reader =
>   new JettisonMappedXmlDriver().createReader(inputStream);
> HierarchicalStreamWriter writer = new PrettyPrintWriter(javaIoWriter);
> new HierarchicalStreamCopier().copy(reader, writer);
> ==================== %< ======================
>
> > In Gora we do data modeling in JSON before we compile the JSON into data
> > beans therefore it would be much easier if I were able to produce XML
> from
> > JSON as oppose to assuming that Java objects will be available.
>
> While you can do so with XStream, you should be aware, that XStream uses
> Jettison as JSON parser, which is a wrapper around StAX translating the
> JSON
> into the StAX model. Therefore you might get away here without the overhead
> of XStream using the MappedXMLInputFactory of Jettison directly, which is
> an
> implementation of StAX' XMLInputFactory.
>
> Note, that newer Jettison version break XStream, because of a strange array
> handling, you'll need version 1.2 (I have not tried latest version 1.3.3
> yet).
>
> Cheers,
> Jörg
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>


-- 
*Lewis*

Reply via email to