X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=retrieval%2Fd1_write.c;h=eb641301a76d0415985485d0fa63392b7fcf60b0;hb=548d8ab9b0b5930db27643b47fc55afce5511219;hp=3990c14e4a41cd98639488ab423bcf7ecc8dee50;hpb=18ed9f15a489511014d4384a53b27e35824dd831;p=yaz-moved-to-github.git diff --git a/retrieval/d1_write.c b/retrieval/d1_write.c index 3990c14..eb64130 100644 --- a/retrieval/d1_write.c +++ b/retrieval/d1_write.c @@ -4,7 +4,15 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: d1_write.c,v $ - * Revision 1.7 1999-10-21 12:06:29 adam + * Revision 1.9 2000-11-29 14:22:47 adam + * Implemented XML/SGML attributes for data1 so that d1_read reads them + * and d1_write generates proper attributes for XML/SGML records. Added + * register locking for threaded version. + * + * Revision 1.8 1999/11/30 13:47:12 adam + * Improved installation. Moved header files to include/yaz. + * + * Revision 1.7 1999/10/21 12:06:29 adam * Retrieval module no longer uses ctype.h - functions. * * Revision 1.6 1999/07/06 12:16:00 adam @@ -32,8 +40,8 @@ #include -#include -#include +#include +#include #define IDSGML_MARGIN 75 @@ -70,8 +78,24 @@ static int nodetoidsgml(data1_node *n, int select, WRBUF b, int col) } else { - sprintf(line, "%*s<%s>\n", col, "", tag); - wrbuf_write(b, line, strlen(line)); +#if DATA1_USING_XATTR + data1_xattr *p; +#endif + sprintf (line, "%*s<", col, ""); + wrbuf_puts (b, line); + wrbuf_puts (b, tag); +#if DATA1_USING_XATTR + for (p = c->u.tag.attributes; p; p = p->next) + { + wrbuf_putc (b, ' '); + wrbuf_puts (b, p->name); + wrbuf_putc (b, '='); + wrbuf_putc (b, '"'); + wrbuf_puts (b, p->value); + wrbuf_putc (b, '"'); + } +#endif + wrbuf_puts(b, ">\n"); if (nodetoidsgml(c, select, b, (col > 40) ? 40 : col+2) < 0) return -1; sprintf (line, "%*s\n", col, "", tag);