More fixes for xmltext
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 8 Oct 2002 22:18:22 +0000 (22:18 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 8 Oct 2002 22:18:22 +0000 (22:18 +0000)
retrieval/d1_grs.c
retrieval/d1_sutrs.c

index 873549c..393a77f 100644 (file)
@@ -3,7 +3,7 @@
  * See the file LICENSE for details.
  * Sebastian Hammer, Adam Dickmeiss
  *
- * $Id: d1_grs.c,v 1.25 2002-08-23 14:27:18 adam Exp $
+ * $Id: d1_grs.c,v 1.26 2002-10-08 22:18:22 adam Exp $
  *
  */
 
@@ -180,6 +180,7 @@ static Z_ElementData *nodetoelementdata(data1_handle dh, data1_node *n,
             *len += 4;
             break;
         case DATA1I_text:
+        case DATA1I_xmltext:
             res->which = Z_ElementData_string;
             res->u.string = (char *)odr_malloc(o, toget+1);
             if (toget)
@@ -212,11 +213,12 @@ static Z_ElementData *nodetoelementdata(data1_handle dh, data1_node *n,
 
 static int is_empty_data (data1_node *n)
 {
-    if (n && n->which == DATA1N_data && n->u.data.what == DATA1I_text)
+    if (n && n->which == DATA1N_data && (n->u.data.what == DATA1I_text
+                               || n->u.data.what == DATA1I_xmltext))
     {
         int i = n->u.data.len;
         
-        while (i > 0 && n->u.data.data[i-1] == '\n')
+        while (i > 0 && strchr("\n ", n->u.data.data[i-1]))
             i--;
         if (i == 0)
             return 1;
index 2117408..ade87d0 100644 (file)
@@ -3,7 +3,7 @@
  * See the file LICENSE for details.
  * Sebastian Hammer, Adam Dickmeiss
  *
- * $Id: d1_sutrs.c,v 1.7 2002-05-03 13:48:27 adam Exp $
+ * $Id: d1_sutrs.c,v 1.8 2002-10-08 22:18:23 adam Exp $
  *
  */
 
@@ -55,7 +55,8 @@ static int nodetobuf(data1_node *n, int select, WRBUF b, int indent, int col)
            int l = c->u.data.len;
            int first = 0;
 
-           if (c->u.data.what == DATA1I_text && c->u.data.formatted_text)
+           if ((c->u.data.what == DATA1I_text ||
+               c->u.data.what == DATA1I_xmltext) && c->u.data.formatted_text)
            {
                wrbuf_putc(b, '\n');
                wrbuf_write(b, c->u.data.data, c->u.data.len);
@@ -63,7 +64,8 @@ static int nodetobuf(data1_node *n, int select, WRBUF b, int indent, int col)
                wrbuf_write(b, line, strlen(line));
                col = indent * NTOBUF_INDENT;
            }
-           else if (c->u.data.what == DATA1I_text)
+           else if (c->u.data.what == DATA1I_text ||
+                    c->u.data.what == DATA1I_xmltext)
            {
                while (l)
                {