Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/pjl-misc into lp:zorba.

Commit message:
Fixed JSON-to-XML bug.

Requested reviews:
  Paul J. Lucas (paul-lucas)

For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/218862

Fixed JSON-to-XML bug.
-- 
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/218862
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'modules/json/json-csv.jq'
--- modules/json/json-csv.jq	2014-03-05 23:36:00 +0000
+++ modules/json/json-csv.jq	2014-05-08 18:38:36 +0000
@@ -141,7 +141,6 @@
  : character.
  : @error csv:INVALID_CSV_VALUE if a value of some key is not castable to
  : string.
- : <code>field-names</code> option is not a string.
  : @error csv:MISSING_VALUE if a missing value is detected and the
  : <code>missing-value</code> option is "<code>error</code>".
  : @error csv:EXTRA_VALUE if an extra value is detected and the

=== modified file 'src/runtime/json/snelson.cpp'
--- src/runtime/json/snelson.cpp	2014-03-20 01:59:46 +0000
+++ src/runtime/json/snelson.cpp	2014-05-08 18:38:36 +0000
@@ -176,10 +176,9 @@
       POP_ITERATOR();
       POP_STATE();
       POP_ITEM_ELEMENT();
-      if ( IN_STATE( in_object ) ) {
+      if ( IN_STATE( in_object ) )
         POP_ITEM( xml );
-        POP_ITEM( json );
-      }
+      POP_ITEM( json );
       continue;
     }
     if ( IN_STATE( in_object ) ) {
@@ -198,7 +197,6 @@
           case store::JS_NULL:
             ADD_TYPE_ATTRIBUTE( "null" );
             ADD_ITEM_ELEMENT( "null" );
-            POP_ITEM_ELEMENT();
             break;
 
           case store::XS_BOOLEAN:
@@ -206,7 +204,6 @@
             ADD_ITEM_ELEMENT( "boolean" );
             value_str = value_item->getBooleanValue() ? "true" : "false";
             GENV_ITEMFACTORY->createTextNode( junk_item, xml_item, value_str );
-            POP_ITEM_ELEMENT();
             break;
 
           case store::XS_BYTE:
@@ -229,7 +226,6 @@
             ADD_ITEM_ELEMENT( "number" );
             value_str = value_item->getStringValue();
             GENV_ITEMFACTORY->createTextNode( junk_item, xml_item, value_str );
-            POP_ITEM_ELEMENT();
             break;
 
           default:
@@ -237,8 +233,8 @@
             ADD_ITEM_ELEMENT( "string" );
             value_str = value_item->getStringValue();
             GENV_ITEMFACTORY->createTextNode( junk_item, xml_item, value_str );
-            POP_ITEM_ELEMENT();
         } // switch
+        POP_ITEM_ELEMENT();
         break;
 
       case store::Item::ARRAY:

=== added file 'test/rbkt/ExpQueryResults/zorba/json/json-snelson-j2x-object-07.xml.res'
--- test/rbkt/ExpQueryResults/zorba/json/json-snelson-j2x-object-07.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/json/json-snelson-j2x-object-07.xml.res	2014-05-08 18:38:36 +0000
@@ -0,0 +1,10 @@
+<json xmlns="http://john.snelson.org.uk/parsing-json-into-xquery"; type="object">
+  <pair name="a" type="object">
+    <pair name="b" type="array">
+      <item type="object">
+        <pair name="c" type="null"/>
+      </item>
+    </pair>
+  </pair>
+  <pair name="d" type="null"/>
+</json>

=== added file 'test/rbkt/Queries/zorba/json/json-snelson-j2x-object-07.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-j2x-object-07.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-j2x-object-07.xq	2014-05-08 18:38:36 +0000
@@ -0,0 +1,12 @@
+import module namespace jx = "http://zorba.io/modules/json-xml";;
+
+let $json :=
+  {
+    "a" : {
+      "b" : [ { "c" : null } ]
+    },
+    "d" : null
+  }
+return jx:json-to-xml( $json )
+
+(: vim:set et sw=2 ts=2: :)

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to