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
Fix bug #249: rstemp sets fail. Problem was that rset files were
[idzebra-moved-to-github.git]
/
recctrl
/
xmlread.c
diff --git
a/recctrl/xmlread.c
b/recctrl/xmlread.c
index
d140323
..
548f0d3
100644
(file)
--- a/
recctrl/xmlread.c
+++ b/
recctrl/xmlread.c
@@
-1,6
+1,6
@@
-/* $Id: xmlread.c,v 1.13 2004-08-11 13:36:13 adam Exp $
- Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
- Index Data Aps
+/* $Id: xmlread.c,v 1.18 2005-01-15 19:38:32 adam Exp $
+ Copyright (C) 1995-2005
+ Index Data ApS
This file is part of the Zebra server.
This file is part of the Zebra server.
@@
-32,11
+32,10
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include <yaz/log.h>
#include <yaz/log.h>
-#include "grsread.h"
+#include <idzebra/recgrs.h>
-#include <yaz/xmalloc.h>
#include <yaz/log.h>
#include <yaz/log.h>
-#include <data1.h>
+#include <yaz/xmalloc.h>
#include <expat.h>
#include <expat.h>
@@
-99,7
+98,7
@@
static void cb_decl (void *user, const char *version, const char *encoding,
data1_mk_preprocess (ui->dh, ui->nmem, "xml", attr_list,
ui->d1_stack[ui->level-1]);
#if 0
data1_mk_preprocess (ui->dh, ui->nmem, "xml", attr_list,
ui->d1_stack[ui->level-1]);
#if 0
- yaz_log (LOG_LOG, "decl version=%s encoding=%s",
+ yaz_log (YLOG_LOG, "decl version=%s encoding=%s",
version ? version : "null",
encoding ? encoding : "null");
#endif
version ? version : "null",
encoding ? encoding : "null");
#endif
@@
-176,7
+175,7
@@
static int cb_external_entity (XML_Parser pparser,
if (!(inf = fopen (systemId, "rb")))
{
if (!(inf = fopen (systemId, "rb")))
{
- yaz_log (LOG_WARN|LOG_ERRNO, "fopen %s", systemId);
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "fopen %s", systemId);
return 0;
}
return 0;
}
@@
-187,7
+186,7
@@
static int cb_external_entity (XML_Parser pparser,
void *buf = XML_GetBuffer (parser, XML_CHUNK);
if (!buf)
{
void *buf = XML_GetBuffer (parser, XML_CHUNK);
if (!buf)
{
- yaz_log (LOG_WARN, "XML_GetBuffer fail");
+ yaz_log (YLOG_WARN, "XML_GetBuffer fail");
break;
}
r = fread (buf, 1, XML_CHUNK, inf);
break;
}
r = fread (buf, 1, XML_CHUNK, inf);
@@
-195,7
+194,7
@@
static int cb_external_entity (XML_Parser pparser,
{
if (ferror(inf))
{
{
if (ferror(inf))
{
- yaz_log (LOG_WARN|LOG_ERRNO, "fread %s", systemId);
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "fread %s", systemId);
break;
}
done = 1;
break;
}
done = 1;
@@
-203,7
+202,7
@@
static int cb_external_entity (XML_Parser pparser,
if (!XML_ParseBuffer (parser, r, done))
{
done = 1;
if (!XML_ParseBuffer (parser, r, done))
{
done = 1;
- yaz_log (LOG_WARN, "%s:%d:%d:XML error: %s",
+ yaz_log (YLOG_WARN, "%s:%d:%d:XML error: %s",
systemId,
XML_GetCurrentLineNumber(parser),
XML_GetCurrentColumnNumber(parser),
systemId,
XML_GetCurrentLineNumber(parser),
XML_GetCurrentColumnNumber(parser),
@@
-228,7
+227,7
@@
static int cb_encoding_convert (void *data, const char *s)
unsigned short code;
#if 1
unsigned short code;
#if 1
- yaz_log(LOG_LOG, "------------------------- cb_encoding_convert --- ");
+ yaz_log(YLOG_LOG, "------------------------- cb_encoding_convert --- ");
#endif
ret = iconv (t, &inbuf, &inleft, &outbuf, &outleft);
if (ret == (size_t) (-1) && errno != E2BIG)
#endif
ret = iconv (t, &inbuf, &inleft, &outbuf, &outleft);
if (ret == (size_t) (-1) && errno != E2BIG)
@@
-344,7
+343,7
@@
static int cb_encoding_handler (void *userData, const char *name,
{
info->map[i] = -1; /* no room for output */
if (i != 0)
{
info->map[i] = -1; /* no room for output */
if (i != 0)
- yaz_log (LOG_WARN, "Encoding %d: no room for output",
+ yaz_log (YLOG_WARN, "Encoding %d: no room for output",
i);
}
}
i);
}
}
@@
-358,7
+357,7
@@
static int cb_encoding_handler (void *userData, const char *name,
else
{ /* should never happen */
info->map[i] = -1;
else
{ /* should never happen */
info->map[i] = -1;
- yaz_log (LOG_DEBUG, "Encoding %d: bad state", i);
+ yaz_log (YLOG_DEBUG, "Encoding %d: bad state", i);
}
}
if (info->data)
}
}
if (info->data)
@@
-402,7
+401,7
@@
data1_node *zebra_read_xml (data1_handle dh,
int done = 0;
data1_node *first_node;
int done = 0;
data1_node *first_node;
- uinfo.loglevel = LOG_DEBUG;
+ uinfo.loglevel = YLOG_DEBUG;
uinfo.level = 1;
uinfo.dh = dh;
uinfo.nmem = m;
uinfo.level = 1;
uinfo.dh = dh;
uinfo.nmem = m;
@@
-431,14
+430,14
@@
data1_node *zebra_read_xml (data1_handle dh,
if (!buf)
{
/* error */
if (!buf)
{
/* error */
- yaz_log (LOG_WARN, "XML_GetBuffer fail");
+ yaz_log (YLOG_WARN, "XML_GetBuffer fail");
break;
}
r = (*rf)(fh, buf, XML_CHUNK);
if (r < 0)
{
/* error */
break;
}
r = (*rf)(fh, buf, XML_CHUNK);
if (r < 0)
{
/* error */
- yaz_log (LOG_WARN, "XML read fail");
+ yaz_log (YLOG_WARN, "XML read fail");
break;
}
else if (r == 0)
break;
}
else if (r == 0)
@@
-446,7
+445,7
@@
data1_node *zebra_read_xml (data1_handle dh,
if (!XML_ParseBuffer (parser, r, done))
{
done = 1;
if (!XML_ParseBuffer (parser, r, done))
{
done = 1;
- yaz_log (LOG_WARN, "%d:%d:XML error: %s",
+ yaz_log (YLOG_WARN, "%d:%d:XML error: %s",
XML_GetCurrentLineNumber(parser),
XML_GetCurrentColumnNumber(parser),
XML_ErrorString(XML_GetErrorCode(parser)));
XML_GetCurrentLineNumber(parser),
XML_GetCurrentColumnNumber(parser),
XML_ErrorString(XML_GetErrorCode(parser)));
@@
-480,7
+479,12
@@
struct xml_info {
XML_Expat_Version expat_version;
};
XML_Expat_Version expat_version;
};
-static void *grs_init_xml(void)
+static data1_node *grs_read_xml (struct grs_read_info *p)
+{
+ return zebra_read_xml (p->dh, p->readf, p->fh, p->mem);
+}
+
+static void *init_xml(Res res, RecType recType)
{
struct xml_info *p = (struct xml_info *) xmalloc (sizeof(*p));
{
struct xml_info *p = (struct xml_info *) xmalloc (sizeof(*p));
@@
-489,27
+493,43
@@
static void *grs_init_xml(void)
return p;
}
return p;
}
-static data1_node *grs_read_xml (struct grs_read_info *p)
+static void destroy_xml(void *clientData)
{
{
- return zebra_read_xml (p->dh, p->readf, p->fh, p->mem);
+ struct xml_info *p = (struct xml_info *) clientData;
+
+ xfree (p);
}
}
-static void grs_destroy_xml(void *clientData)
+static int extract_xml(void *clientData, struct recExtractCtrl *ctrl)
{
{
- struct xml_info *p = (struct xml_info *) clientData;
+ return zebra_grs_extract(clientData, ctrl, grs_read_xml);
+}
- xfree (p);
+static int retrieve_xml(void *clientData, struct recRetrieveCtrl *ctrl)
+{
+ return zebra_grs_retrieve(clientData, ctrl, grs_read_xml);
}
}
-static struct recTypeGrs xml_type = {
- "xml",
- grs_init_xml,
- grs_destroy_xml,
- grs_read_xml
+static struct recType xml_type = {
+ "grs.xml",
+ init_xml,
+ 0,
+ destroy_xml,
+ extract_xml,
+ retrieve_xml,
};
};
-RecTypeGrs recTypeGrs_xml = &xml_type;
+RecType
+#ifdef IDZEBRA_STATIC_GRS_XML
+idzebra_filter_grs_xml
+#else
+idzebra_filter
+#endif
-/* HAVE_EXPAT_H */
+[] = {
+ &xml_type,
+ 0,
+};
+
#endif
#endif