abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Elias Torres" <el...@torrez.us>
Subject Re: Named Parsers and Writers
Date Thu, 29 Jun 2006 01:29:05 GMT
+1

On 6/28/06, James M Snell <jasnell@gmail.com> wrote:
> One of the goals I've been working towards is the ability to output and
> parse Atom from alternative formats.  For instance, we have a JSON
> rendering of Atom we've been working on.  There's also an RDF rendering.
> I've extended Parser and have introduced new Writer interfaces to allow
> for this.
>
> For instance, suppose I want to output Atom as JSON...
>
>   Writer writer = WriterFactory.getInstance("json");
>   writer.writeTo(feed, outputStream);
>
> Or, RDF
>
>   Writer writer = WriterFactory.getInstance("rdf");
>   writer.writeTo(feed, outputStream);
>
> Alternatively, I could new up a Writer
>
>   Writer writer = new JsonWriter();
>
> It would work the same on the parsing side.  Suppose I want to parse
> from JSON or RDF
>
>   Parser parser = ParserFactory.getInstance("json");
>   parser.parse(...)
>
>   Parser parser = ParserFactory.getInstance("rdf");
>   parser.parse(...)
>
> The named parsers implement the exact same API as the default Abdera parser.
>
> If there are no objections, I'll check it in.
>
> - James
>

Mime
View raw message