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 2007/09/29 03:16:01 UTC

svn commit: r580528 - /incubator/abdera/java/trunk/extensions/json/src/main/java/org/apache/abdera/ext/json/JSONUtil.java

Author: jmsnell
Date: Fri Sep 28 18:16:00 2007
New Revision: 580528

URL: http://svn.apache.org/viewvc?rev=580528&view=rev
Log:
rollback an earlier change.  we can't just output a simple string when type="text"
because we end up dropping potentially important data on the floor.

Modified:
    incubator/abdera/java/trunk/extensions/json/src/main/java/org/apache/abdera/ext/json/JSONUtil.java

Modified: incubator/abdera/java/trunk/extensions/json/src/main/java/org/apache/abdera/ext/json/JSONUtil.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/json/src/main/java/org/apache/abdera/ext/json/JSONUtil.java?rev=580528&r1=580527&r2=580528&view=diff
==============================================================================
--- incubator/abdera/java/trunk/extensions/json/src/main/java/org/apache/abdera/ext/json/JSONUtil.java (original)
+++ incubator/abdera/java/trunk/extensions/json/src/main/java/org/apache/abdera/ext/json/JSONUtil.java Fri Sep 28 18:16:00 2007
@@ -125,12 +125,15 @@
       jstream.writeField("src", content.getResolvedSrc());
       switch(content.getContentType()) {
         case TEXT:
+          jstream.writeField("type","text");
           jstream.writeField("value",content.getValue());
           break;
         case HTML:
+          jstream.writeField("type","html");
           jstream.writeField("value",content.getValue());
           break;
         case XHTML:
+          jstream.writeField("type","xhtml");
           jstream.writeField("value",content.getValue());
           writeElementValue((Div)content.getValueElement(), jstream);
           break;
@@ -215,12 +218,15 @@
       Text text = (Text)element;      
       switch(text.getTextType()) {
         case TEXT:
+          jstream.writeField("type","text");
           jstream.writeField("value",text.getValue());
           break;
         case HTML:
+          jstream.writeField("type","html");
           jstream.writeField("value",text.getValue());
           break;
         case XHTML:
+          jstream.writeField("type","xhtml");
           jstream.writeField("value",text.getValue());
           writeElementValue(text.getValueElement(), jstream);
           break;
@@ -375,9 +381,7 @@
       throws IOException {
     if (element != null) {
       jstream.writeField(name);
-      if (element instanceof Text && ((Text)element).getTextType() == Text.Type.TEXT)
-        jstream.writeQuoted(((Text)element).getValue());  
-      else toJson(element,jstream);
+      toJson(element,jstream);
     }
   }