Update of /cvsroot/monetdb/pathfinder/src/tools/xml-shred
In directory sc8-pr-cvs16:/tmp/cvs-serv20709

Modified Files:
        xml-shred.c 
Log Message:


We are modifying the schema to separate the pre values of nodes from pre values 
of
attributes.


Index: xml-shred.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/src/tools/xml-shred/xml-shred.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- xml-shred.c 8 May 2007 10:02:50 -0000       1.4
+++ xml-shred.c 10 May 2007 14:39:32 -0000      1.5
@@ -135,6 +135,7 @@
 typedef struct node_t node_t;
 struct node_t {
     nat       pre;
+    nat       apre;
     nat       post;
     nat       pre_stretched;
     nat       post_stretched;
@@ -259,6 +260,7 @@
 
     stack[level] = (node_t) {
         .pre            = pre,
+       .apre           = -1,
         .post           = 0,
         .pre_stretched  = rank,
         .post_stretched = 0,
@@ -267,7 +269,7 @@
         .parent         = stack + level - 1,
        .name_id        = name_id, 
         .kind           = elem,
-        .prop           = NULL 
+        .prop           = (!sql_atts)?strndup((char*)tagname, TAG_SIZE):NULL 
     };
 
 
@@ -316,12 +318,13 @@
 
                pre++;
                print_tuple ((node_t) {
-                       .pre = pre,
+                       .pre = -1,
+                       .apre = pre,
                        .post = 0,
                        .pre_stretched = 0,
                        .post_stretched = 0,
                        .size = 0,
-                       .level = 1,
+                       .level = level + 1,
                        .parent = 0,
                        .name_id = name_id,
                        .kind = attr,
@@ -381,6 +384,7 @@
 
         stack[level] = (node_t) {
             .pre            = pre,
+           .apre           = -1,
             .post           = post,
             .pre_stretched  = rank - 1,
             .post_stretched = rank,
@@ -455,7 +459,11 @@
         if (format[i] == '%') {
             i++;
             switch (format[i]) {
-                case 'e':  fprintf (out, "%lu", tuple.pre); break;
+                case 'e':  if(tuple.pre == -1)
+                              fprintf (out, "");
+                          else
+                              fprintf (out, "%lu", tuple.pre);
+                          break;
                 case 'o':  fprintf (out, "%lu", tuple.post); break;
                 case 'E':  fprintf (out, "%lu", tuple.pre_stretched); break;
                 case 'O':  fprintf (out, "%lu", tuple.post_stretched); break;
@@ -486,9 +494,14 @@
                            break;
                case 'n':
                        if (tuple.name_id == -1)
-                           fprintf(out, "NULL");
+                           fprintf(out, "");
                        else 
                            fprintf(out, "%i", tuple.name_id); break;
+               case 'a':
+                       if (tuple.apre == -1)
+                           fprintf(out, "");
+                       else
+                           fprintf(out, "%lu", tuple.apre); break;
                 case 't':
                {
                    if(tuple.prop) {
@@ -556,7 +569,7 @@
 
            case 's':
                sql_atts = true;
-               format = "%e, %s, %l, %k, %n, %t";
+               format = "%e, %a, %s, %l, %k, %n, %t";
                break;
 
             case 'h':


-------------------------------------------------------------------------
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