fixing bare "array" inside fieldmapper objects
authormiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Tue, 2 Aug 2005 19:58:09 +0000 (19:58 +0000)
committermiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Tue, 2 Aug 2005 19:58:09 +0000 (19:58 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@448 9efc2488-bf62-4759-914b-345cdb29e865

src/gateway/fieldmapper-c-xml-out.pl

index fc9e563..7f7ef3e 100755 (executable)
@@ -78,7 +78,7 @@ void _rest_xml_output(growing_buffer* buf, object* obj, char * fm_class, int fm_
        int i;
        
 
-       if(fm_class ) {
+       if(fm_class) {
                tag = _lookup_fm_field(fm_class,fm_index);
        } else {
                tag = strdup("datum");
@@ -109,13 +109,20 @@ void _rest_xml_output(growing_buffer* buf, object* obj, char * fm_class, int fm_
 
 
        else if (obj->is_array) {
-               if (!obj->classname)
+               if(!fm_class)
                                buffer_add(buf,"<array>");
+               else
+                               buffer_fadd(buf,"<%s>",tag);
+
                for( i = 0; i!= obj->size; i++ ) {
                        _rest_xml_output(buf, obj->get_index(obj,i), obj->classname, i);
                }
-               if (!obj->classname)
-                       buffer_add(buf,"</array>");
+
+               if(!fm_class)
+                               buffer_add(buf,"</array>");
+               else
+                               buffer_fadd(buf,"</%s>",tag);
+
         } else if (obj->is_hash) {
                        buffer_add(buf,"<hash>");
                 object_iterator* itr = new_iterator(obj);