Wednesday 15 June 2011

calabash and json

  
<p:unescape-markup content-type="application/json"/>
There seem to be two problems:

  1. Leading white space causes failure.
  2. content type may have charset e.g. content-type="application/json;charset="UTF-8"" 
Fix for first is to use nextClean() in place of next() in com.xmlcalabash.util.JSONtoXML.java
  private static void build(TreeWriter tree, JSONTokener jt) {
        tree.addStartElement(_json);

        try {
            char ch = jt.nextClean();
            jt.back();

No comments:

Post a Comment