fixed logic bug in the xpath finder
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 10 Oct 2005 23:04:39 +0000 (23:04 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 10 Oct 2005 23:04:39 +0000 (23:04 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1907 dcc99617-32d9-48b4-a31d-7c20da2025e4

OpenSRF/src/objson/object.c

index ee3dbff..f427936 100644 (file)
@@ -702,7 +702,17 @@ jsonObject* _jsonObjectFindPathRecurse(const jsonObject* obj, char* root, char*
                for( i = 0; i < arr->size; i++ ) {
                        jsonObject* a = jsonObjectGetIndex(arr, i);
                        jsonObject* thing = jsonObjectFindPath(a , path + strlen(root) + 1); 
-                       if(thing) jsonObjectPush(newarr, thing);
+
+                       if(thing) { //jsonObjectPush(newarr, thing);
+               if(thing->type == JSON_ARRAY) {
+               int i;
+                                       for( i = 0; i != thing->size; i++ )
+                                               jsonObjectPush(newarr, jsonObjectGetIndex(thing,i));
+
+                               } else {
+                                       jsonObjectPush(newarr, thing);
+                               }                                               
+                       }
                }
        }