X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=recctrl%2Fxmlread.c;h=a5bd0069d547652efe8d5c6f95372fb26e38cdfc;hb=a9eae0225b1a51b0257f80d9da9f95475dd04f53;hp=6bc8efab5baefc0f040c8b8f993a0cc3eac8cf61;hpb=d9fb3117ca1b5f0038f8367c9a1d5d8f933b8920;p=idzebra-moved-to-github.git diff --git a/recctrl/xmlread.c b/recctrl/xmlread.c index 6bc8efa..a5bd006 100644 --- a/recctrl/xmlread.c +++ b/recctrl/xmlread.c @@ -1,4 +1,4 @@ -/* $Id: xmlread.c,v 1.12 2004-07-26 12:26:25 adam Exp $ +/* $Id: xmlread.c,v 1.15 2004-09-28 10:15:03 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -32,11 +32,10 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include -#include "grsread.h" +#include #include #include -#include #include @@ -98,9 +97,11 @@ 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 yaz_log (LOG_LOG, "decl version=%s encoding=%s", version ? version : "null", encoding ? encoding : "null"); +#endif } static void cb_processing (void *user, const char *target, @@ -478,7 +479,12 @@ struct xml_info { 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)); @@ -487,27 +493,43 @@ static void *grs_init_xml(void) 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