New filter grs.marcxml.
[idzebra-moved-to-github.git] / recctrl / xmlread.c
index 0cb5a75..5071fc5 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: xmlread.c,v 1.5 2002-08-29 09:59:25 adam Exp $
+/* $Id: xmlread.c,v 1.8 2003-08-21 10:29:00 adam Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
    Index Data Aps
 
@@ -36,7 +36,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 #include <yaz/xmalloc.h>
 #include <yaz/log.h>
-#include <yaz/data1.h>
+#include <data1.h>
 
 #include <expat.h>
 
@@ -226,6 +226,9 @@ static int cb_encoding_convert (void *data, const char *s)
     char *inbuf = (char *) s;
     unsigned short code;
 
+#if 1
+    yaz_log(LOG_LOG, "------------------------- cb_encoding_convert --- ");
+#endif
     ret = iconv (t, &inbuf, &inleft, &outbuf, &outleft);
     if (ret == (size_t) (-1) && errno != E2BIG)
     {
@@ -339,8 +342,9 @@ static int cb_encoding_handler (void *userData, const char *name,
             if (errno == E2BIG)
             {
                 info->map[i] = -1;  /* no room for output */
-                yaz_log (LOG_WARN, "Encoding %d: no room for output",
-                         i);
+                if (i != 0)
+                    yaz_log (LOG_WARN, "Encoding %d: no room for output",
+                             i);
             }
         }
         else if (outleft == 0)
@@ -375,7 +379,19 @@ static int cb_encoding_handler (void *userData, const char *name,
 /* HAVE_ICONV_H */
 #endif
 
+static void cb_ns_start(void *userData, const char *prefix, const char *uri)
+{
+    struct user_info *ui = (struct user_info*) userData;
+    if (prefix && uri)
+       yaz_log(ui->loglevel, "cb_ns_start %s %s", prefix, uri);
+}
 
+static void cb_ns_end(void *userData, const char *prefix)
+{
+    struct user_info *ui = (struct user_info*) userData;
+    if (prefix)
+       yaz_log(ui->loglevel, "cb_ns_end %s", prefix);
+}
 data1_node *zebra_read_xml (data1_handle dh,
                             int (*rf)(void *, char *, size_t), void *fh,
                             NMEM m)
@@ -402,6 +418,7 @@ data1_node *zebra_read_xml (data1_handle dh,
     XML_SetDoctypeDeclHandler (parser, cb_doctype_start, cb_doctype_end);
     XML_SetEntityDeclHandler (parser, cb_entity_decl);
     XML_SetExternalEntityRefHandler (parser, cb_external_entity);
+    XML_SetNamespaceDeclHandler(parser, cb_ns_start, cb_ns_end);
 #if HAVE_ICONV_H
     XML_SetUnknownEncodingHandler (parser, cb_encoding_handler, &uinfo);
 #endif