projects
/
idzebra-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added test/codec/Makefile
[idzebra-moved-to-github.git]
/
recctrl
/
xmlread.c
diff --git
a/recctrl/xmlread.c
b/recctrl/xmlread.c
index
90b17d3
..
d89194e
100644
(file)
--- a/
recctrl/xmlread.c
+++ b/
recctrl/xmlread.c
@@
-1,5
+1,5
@@
-/* $Id: xmlread.c,v 1.3 2002-08-28 12:47:10 adam Exp $
- Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
+/* $Id: xmlread.c,v 1.11 2003-09-08 09:51:02 adam Exp $
+ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
Index Data Aps
This file is part of the Zebra server.
Index Data Aps
This file is part of the Zebra server.
@@
-36,7
+36,7
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include <yaz/xmalloc.h>
#include <yaz/log.h>
#include <yaz/xmalloc.h>
#include <yaz/log.h>
-#include <yaz/data1.h>
+#include <data1.h>
#include <expat.h>
#include <expat.h>
@@
-202,7
+202,11
@@
static int cb_external_entity (XML_Parser pparser,
}
if (!XML_ParseBuffer (parser, r, done))
{
}
if (!XML_ParseBuffer (parser, r, done))
{
- yaz_log (LOG_WARN, "XML_ParseBuffer failed %s",
+ done = 1;
+ yaz_log (LOG_WARN, "%s:%d:%d:XML error: %s",
+ systemId,
+ XML_GetCurrentLineNumber(parser),
+ XML_GetCurrentColumnNumber(parser),
XML_ErrorString(XML_GetErrorCode(parser)));
}
}
XML_ErrorString(XML_GetErrorCode(parser)));
}
}
@@
-223,6
+227,9
@@
static int cb_encoding_convert (void *data, const char *s)
char *inbuf = (char *) s;
unsigned short code;
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)
{
ret = iconv (t, &inbuf, &inleft, &outbuf, &outleft);
if (ret == (size_t) (-1) && errno != E2BIG)
{
@@
-336,8
+343,9
@@
static int cb_encoding_handler (void *userData, const char *name,
if (errno == E2BIG)
{
info->map[i] = -1; /* no room for output */
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)
}
}
else if (outleft == 0)
@@
-372,7
+380,19
@@
static int cb_encoding_handler (void *userData, const char *name,
/* HAVE_ICONV_H */
#endif
/* 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)
data1_node *zebra_read_xml (data1_handle dh,
int (*rf)(void *, char *, size_t), void *fh,
NMEM m)
@@
-381,7
+401,7
@@
data1_node *zebra_read_xml (data1_handle dh,
struct user_info uinfo;
int done = 0;
struct user_info uinfo;
int done = 0;
- uinfo.loglevel = LOG_LOG;
+ uinfo.loglevel = LOG_DEBUG;
uinfo.level = 1;
uinfo.dh = dh;
uinfo.nmem = m;
uinfo.level = 1;
uinfo.dh = dh;
uinfo.nmem = m;
@@
-399,6
+419,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_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
#if HAVE_ICONV_H
XML_SetUnknownEncodingHandler (parser, cb_encoding_handler, &uinfo);
#endif
@@
-423,7
+444,10
@@
data1_node *zebra_read_xml (data1_handle dh,
done = 1;
if (!XML_ParseBuffer (parser, r, done))
{
done = 1;
if (!XML_ParseBuffer (parser, r, done))
{
- yaz_log (LOG_WARN, "XML_ParseBuffer (1) failed %s",
+ done = 1;
+ yaz_log (LOG_WARN, "%d:%d:XML error: %s",
+ XML_GetCurrentLineNumber(parser),
+ XML_GetCurrentColumnNumber(parser),
XML_ErrorString(XML_GetErrorCode(parser)));
}
}
XML_ErrorString(XML_GetErrorCode(parser)));
}
}
@@
-434,12
+458,15
@@
data1_node *zebra_read_xml (data1_handle dh,
}
struct xml_info {
}
struct xml_info {
- int dummy;
+ XML_Expat_Version expat_version;
};
static void *grs_init_xml(void)
{
struct xml_info *p = (struct xml_info *) xmalloc (sizeof(*p));
};
static void *grs_init_xml(void)
{
struct xml_info *p = (struct xml_info *) xmalloc (sizeof(*p));
+
+ p->expat_version = XML_ExpatVersionInfo();
+
return p;
}
return p;
}
@@
-450,7
+477,7
@@
static data1_node *grs_read_xml (struct grs_read_info *p)
static void grs_destroy_xml(void *clientData)
{
static void grs_destroy_xml(void *clientData)
{
- struct sgml_getc_info *p = (struct sgml_getc_info *) clientData;
+ struct xml_info *p = (struct xml_info *) clientData;
xfree (p);
}
xfree (p);
}