abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James M Snell <jasn...@gmail.com>
Subject Named Parsers and Writers
Date Wed, 28 Jun 2006 14:16:13 GMT
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);


  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 parser = ParserFactory.getInstance("rdf");

The named parsers implement the exact same API as the default Abdera parser.

If there are no objections, I'll check it in.

- James

View raw message