Update of /cvsroot/monetdb/pathfinder/runtime
In directory sc8-pr-cvs16:/tmp/cvs-serv29521

Modified Files:
      Tag: XQuery_0-16
        xrpc_client.mx 
Log Message:
Made get_rpc_res() better resistent to white-spaces between nodes that
should just be discarded.



Index: xrpc_client.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc_client.mx,v
retrieving revision 1.6.2.12
retrieving revision 1.6.2.13
diff -u -d -r1.6.2.12 -r1.6.2.13
--- xrpc_client.mx      31 Mar 2007 12:08:42 -0000      1.6.2.12
+++ xrpc_client.mx      25 Apr 2007 18:26:40 -0000      1.6.2.13
@@ -147,7 +147,9 @@
     # value can appear more than once in the "pre_prop" bat.
     seq_prop := pre_prop.ord_select(seq_prop).reverse().fetch(0);
 
-    var tpe_node_level :=  pre_level.find(seq_prop).int() + 1;
+    var seq_node_level :=  pre_level.find(seq_prop).int();
+    var tpe_node_level :=  seq_node_level + 1;
+    var val_node_level :=  tpe_node_level + 1;
     var itercnt := 0;
     var tpe := "";
     var subtpe := "";
@@ -163,13 +165,13 @@
             var kind  := pre_kind.fetch(pre);
             var prop  := pre_prop.fetch(pre);
 
-            if (level = (tpe_node_level - 1)) {
+            if ( and(level = seq_node_level, kind='\000') ){
                 var loc := qn_loc.fetch(prop);
                 var uri := qn_uri.fetch(prop);
                 if (and((loc = "sequence"), (uri = xrpc_ns))) {
                     itercnt :+= 1; # A new iteration starts
                 }
-            } else if (level = tpe_node_level) {
+            } else if ( and(level = tpe_node_level, kind='\000') ){
                 var tpe_node_ns := qn_uri.fetch(prop);
                 if (tpe_node_ns != xrpc_ns) {
                     ERROR("get_rpc_res (batloop %d): invalid " +
@@ -213,13 +215,14 @@
                     var i := 
set_kind(local_name.leftjoin(reverse(ws.fetch(CONT_NAME))).tmark([EMAIL 
PROTECTED]), ATTR);
                     res_kind.append(i);
                 }
-            } else if (level = (tpe_node_level + 1)) {
+            } else if (level = val_node_level) {
                 # 'tpe' was set during the previous iteration of 'batloop'
-                if (tpe = "element"){
+                if ( and(tpe = "element", kind='\000') ){
                     res_iter.append(oid(itercnt));
                     res_item.append(pre_nid.find(pre));
                     var i := 
set_kind(local_name.leftjoin(reverse(ws.fetch(CONT_NAME))).tmark([EMAIL 
PROTECTED]), ELEM);
                     res_kind.append(i);
+                    tpe := ""; # clean up type info
                 } else if (tpe = "text") { # text value of a text node
                     if (kind != '\001'){
                         ERROR("get_rpc_res (batloop %d): a text node " +
@@ -230,6 +233,7 @@
                     res_item.append(pre_nid.find(pre));
                     var i := 
set_kind(local_name.leftjoin(reverse(ws.fetch(CONT_NAME))).tmark([EMAIL 
PROTECTED]), ELEM);
                     res_kind.append(i);
+                    tpe := ""; # clean up type info
                 } else if (tpe = "atomic-value") { # string value of an 
atomic-value
                     var val := prop_text.fetch(prop); # value in str
                     if (subtpe = "boolean"){ # FIXME: does this work?
@@ -266,20 +270,22 @@
                                "value with unsupported type \"%s\" " +
                                "ignored.\n", subtpe);
                     }
+                    tpe := ""; # clean up type info
                 } else if (tpe = "comment") { # text value of a comment node   
             
                     # FIXME: does this work?
                     res_iter.append(oid(itercnt));
                     res_item.append(pre_nid.find(pre));
                     var i := 
set_kind(local_name.leftjoin(reverse(ws.fetch(CONT_NAME))).tmark([EMAIL 
PROTECTED]), ELEM);
                     res_kind.append(i);
+                    tpe := ""; # clean up type info
                 } else if (tpe = "processing-instruction") { # text value of a 
PI node
                     # FIXME: does this work?
                     res_iter.append(oid(itercnt));
                     res_item.append(pre_nid.find(pre));
                     var i := 
set_kind(local_name.leftjoin(reverse(ws.fetch(CONT_NAME))).tmark([EMAIL 
PROTECTED]), ELEM);
                     res_kind.append(i);
+                    tpe := ""; # clean up type info
                 } 
-                tpe := ""; # clean up type info
             } # END 'if (level = ...)'
         } # END 'if (not(isnil($t)))'
     } # END '[EMAIL PROTECTED]'


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to