You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@abdera.apache.org by jm...@apache.org on 2008/01/14 02:19:40 UTC

svn commit: r611692 - /incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/ext/Json.java

Author: jmsnell
Date: Sun Jan 13 17:19:35 2008
New Revision: 611692

URL: http://svn.apache.org/viewvc?rev=611692&view=rev
Log:
minor revision to the json example

Modified:
    incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/ext/Json.java

Modified: incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/ext/Json.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/ext/Json.java?rev=611692&r1=611691&r2=611692&view=diff
==============================================================================
--- incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/ext/Json.java (original)
+++ incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/ext/Json.java Sun Jan 13 17:19:35 2008
@@ -19,7 +19,6 @@
 
 import org.apache.abdera.Abdera;
 import org.apache.abdera.model.Entry;
-import org.apache.abdera.writer.Writer;
 
 /**
  * The JSONWriter can be used to serialize an Abdera entry into a JSON structure
@@ -35,27 +34,23 @@
     entry.setContentAsHtml("<b>foo</b>");
     entry.addAuthor("James");
     entry.addCategory("term");
-    
-    Writer w = abdera.getWriterFactory().getWriter("json");
-    entry.writeTo(w, System.out);
+    entry.writeTo("json", System.out);
     
     /**
      * Produces: 
      * 
      * {
-     *   "categories":[
-     *     {"term":"term"}
-     *   ],
-     *   "id":"urn:uuid:BFE2C793F1E4327BA91187720122895",
-     *   "content":{
-     *     "type":"html",
-     *     "value":"<b>foo<\/b>"},
-     *   "links":[],
-     *   "contributors":[],
-     *   "authors":[
-     *     {"name":"James"}
-     *   ],
-     *   "title":"test"}
+     * "id":"urn:uuid:97893C35372BE77BD51200273434152",
+     *  "title":"test",
+     *  "content":{
+     *   "attributes":{"type":"html"},
+     *   "children":[{
+     *     "name":"b",
+     *     "attributes":{},
+     *     "children":["foo"]}]},
+     *  "authors":[{"name":"James"}],
+     *  "categories":[{"term":"term"}]
+     * }
      */
   }