X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fmod_dom.c;h=f4f56436d354cb71b395d0587e440fa6cc0b9019;hb=5e2a64f624de4bd6fae0a69a5db5fb0fdb588ee0;hp=9f2dd07c4b20ef9d4d52020564f9e719031d413b;hpb=a101ad077b7c8cb3ea5b658e994b9e8e83fd3bb7;p=idzebra-moved-to-github.git diff --git a/index/mod_dom.c b/index/mod_dom.c index 9f2dd07..f4f5643 100644 --- a/index/mod_dom.c +++ b/index/mod_dom.c @@ -1,4 +1,4 @@ -/* $Id: mod_dom.c,v 1.11 2007-02-14 16:43:37 marc Exp $ +/* $Id: mod_dom.c,v 1.13 2007-02-15 14:33:41 marc Exp $ Copyright (C) 1995-2007 Index Data ApS @@ -42,6 +42,22 @@ #include #include + + +/* Alvis style indexing */ +#define ZEBRA_SCHEMA_XSLT_NS "http://indexdata.dk/zebra/xslt/1" +static const char *zebra_xslt_ns = ZEBRA_SCHEMA_XSLT_NS; + +/* DOM filter style indexing */ +#define ZEBRA_DOM_NS "http://indexdata.com/zebra-2.0" +static const char *zebra_dom_ns = ZEBRA_DOM_NS; + +/* DOM filter style indexing */ +#define ZEBRA_PI_NAME "zebra-2.0" +static const char *zebra_pi_name = ZEBRA_PI_NAME; + + + struct convert_s { const char *stylesheet; xsltStylesheetPtr stylesheet_xsp; @@ -242,9 +258,10 @@ static ZEBRA_RES parse_convert(struct filter_info *tinfo, xmlNodePtr ptr, ; else yaz_log(YLOG_WARN, "%s: dom filter: " - "bad attribute %s" - " for ", - tinfo->fname, attr->name); + "%s bad attribute @%s, " + "expected @stylesheet", + tinfo->fname, + xmlGetNodePath(ptr), attr->name); if (p->stylesheet) { char tmp_xslt_full_name[1024]; @@ -253,8 +270,7 @@ static ZEBRA_RES parse_convert(struct filter_info *tinfo, xmlNodePtr ptr, NULL, tmp_xslt_full_name)) { - yaz_log(YLOG_WARN, - "%s: dom filter: " + yaz_log(YLOG_WARN, "%s: dom filter: " "stylesheet %s not found in " "path %s", tinfo->fname, @@ -268,8 +284,7 @@ static ZEBRA_RES parse_convert(struct filter_info *tinfo, xmlNodePtr ptr, tmp_xslt_full_name); if (!p->stylesheet_xsp) { - yaz_log(YLOG_WARN, - "%s: dom filter: " + yaz_log(YLOG_WARN, "%s: dom filter: " "could not parse xslt " "stylesheet %s", tinfo->fname, tmp_xslt_full_name); @@ -278,10 +293,9 @@ static ZEBRA_RES parse_convert(struct filter_info *tinfo, xmlNodePtr ptr, } else { - yaz_log(YLOG_WARN, - "%s: dom filter: " - "missing attribute 'stylesheet' " - "for element 'xslt'", tinfo->fname); + yaz_log(YLOG_WARN, "%s: dom filter: " + "%s missing attribute 'stylesheet' ", + tinfo->fname, xmlGetNodePath(ptr)); return ZEBRA_FAIL; } *l = p; @@ -290,8 +304,9 @@ static ZEBRA_RES parse_convert(struct filter_info *tinfo, xmlNodePtr ptr, else { yaz_log(YLOG_LOG, - "%s: dom filter: bad node '%s' for ", - tinfo->fname, ptr->name); + "%s: dom filter: " + "%s bad node '%s'", + tinfo->fname, xmlGetNodePath(ptr), ptr->name); return ZEBRA_FAIL; } @@ -351,18 +366,19 @@ static ZEBRA_RES parse_input(struct filter_info *tinfo, xmlNodePtr ptr, if (attr_content(attr, "charset", &input_charset)) ; else - yaz_log(YLOG_WARN, - "%s: dom filter: bad attribute %s" - " for ", - tinfo->fname, attr->name); + yaz_log(YLOG_WARN, "%s: dom filter: " + "%s bad attribute @%s," + " expected @charset", + tinfo->fname, + xmlGetNodePath(ptr), attr->name); } iconv = yaz_iconv_open("utf-8", input_charset); if (!iconv) { - yaz_log(YLOG_WARN, - "%s: dom filter: unsupported charset " - "'%s' for ", - tinfo->fname, input_charset); + yaz_log(YLOG_WARN, "%s: dom filter: " + "%s unsupported @charset '%s'", + tinfo->fname, xmlGetNodePath(ptr), + input_charset); return ZEBRA_FAIL; } else @@ -396,10 +412,11 @@ static ZEBRA_RES parse_input(struct filter_info *tinfo, xmlNodePtr ptr, if (attr_content(attr, "level", &level_str)) ; else - yaz_log(YLOG_WARN, - "%s: dom filter: bad attribute %s" - " for ", - tinfo->fname, attr->name); + yaz_log(YLOG_WARN, "%s: dom filter: " + "%s bad attribute @%s," + " expected @level", + tinfo->fname, xmlGetNodePath(ptr), + attr->name); } if (level_str) p->u.xmlreader.split_level = atoi(level_str); @@ -411,8 +428,10 @@ static ZEBRA_RES parse_input(struct filter_info *tinfo, xmlNodePtr ptr, } else { - yaz_log(YLOG_WARN, "%s: dom filter: bad input type %s", - tinfo->fname, ptr->name); + yaz_log(YLOG_WARN, "%s: dom filter: " + "%s bad element <%s>," + " expected |", + tinfo->fname, xmlGetNodePath(ptr), ptr->name); return ZEBRA_FAIL; } } @@ -433,13 +452,14 @@ static ZEBRA_RES parse_dom(struct filter_info *tinfo, const char *fname) else tinfo->full_name = odr_strdup(tinfo->odr_config, tinfo->fname); - yaz_log(YLOG_LOG, "dom filter: loading config file %s", tinfo->full_name); + yaz_log(YLOG_LOG, "%s dom filter: " + "loading config file %s", tinfo->fname, tinfo->full_name); doc = xmlParseFile(tinfo->full_name); if (!doc) { - yaz_log(YLOG_WARN, - "%s: dom filter: failed to parse config file %s", + yaz_log(YLOG_WARN, "%s: dom filter: " + "failed to parse config file %s", tinfo->fname, tinfo->full_name); return ZEBRA_FAIL; } @@ -450,9 +470,10 @@ static ZEBRA_RES parse_dom(struct filter_info *tinfo, const char *fname) if (!ptr || ptr->type != XML_ELEMENT_NODE || XML_STRCMP(ptr->name, "dom")) { - yaz_log(YLOG_WARN, - "%s: dom filter: expected root element ", - tinfo->fname); + yaz_log(YLOG_WARN, "%s: dom filter: " + "%s bad root element <%s>," + " expected root element ", + tinfo->fname, xmlGetNodePath(ptr), ptr->name); return ZEBRA_FAIL; } @@ -480,10 +501,11 @@ static ZEBRA_RES parse_dom(struct filter_info *tinfo, const char *fname) if (attr_content(attr, "name", &f->name)) ; else - yaz_log(YLOG_WARN, - "%s: dom filter: bad attribute %s" - " for ", - tinfo->fname, attr->name); + yaz_log(YLOG_WARN, "%s: dom filter: " + "%s bad attribute @%s" + " expected @name", + tinfo->fname, + xmlGetNodePath(ptr),attr->name); } parse_convert(tinfo, ptr->children, &f->convert); @@ -518,17 +540,18 @@ static ZEBRA_RES parse_dom(struct filter_info *tinfo, const char *fname) else if (attr_content(attr, "name", &f->name)) ; else - yaz_log(YLOG_WARN, - "%s: dom filter: bad attribute %s" - " for ", - tinfo->fname, attr->name); + yaz_log(YLOG_WARN, "%s: dom filter: " + "%s bad attribute @%s" + " expected @identifier|@name", + tinfo->fname, + xmlGetNodePath(ptr),attr->name); } parse_convert(tinfo, ptr->children, &f->convert); } else if (!XML_STRCMP(ptr->name, "store")) { /* - + @@ -560,17 +583,20 @@ static ZEBRA_RES parse_dom(struct filter_info *tinfo, const char *fname) else if (attr_content(attr, "name", &name)) ; else - yaz_log(YLOG_WARN, - "%s: dom filter: bad attribute %s" - " for ", - tinfo->fname, attr->name); + yaz_log(YLOG_WARN, "%s: dom filter: " + "%s bad attribute @%s" + " expected @syntax|@name", + tinfo->fname, + xmlGetNodePath(ptr),attr->name); } parse_input(tinfo, ptr->children, syntax, name); } else { - yaz_log(YLOG_WARN, "%s: dom filter: bad element %s", - tinfo->fname, ptr->name); + yaz_log(YLOG_WARN, "%s: dom filter: " + "%s bad element <%s>," + " expected |||", + tinfo->fname, xmlGetNodePath(ptr), ptr->name); return ZEBRA_FAIL; } } @@ -638,9 +664,6 @@ static int ioclose_ex(void *context) } -/* Alvis style indexing */ -#define ZEBRA_SCHEMA_XSLT_NS "http://indexdata.dk/zebra/xslt/1" -static const char *zebra_xslt_ns = ZEBRA_SCHEMA_XSLT_NS; /* Alvis style indexing */ static void index_cdata(struct filter_info *tinfo, struct recExtractCtrl *ctrl, @@ -682,9 +705,8 @@ static void index_node(struct filter_info *tinfo, struct recExtractCtrl *ctrl, else if (attr_content(attr, "type", &type_str)) ; else - yaz_log(YLOG_WARN, - "%s: dom filter: bad attribute %s" - " for ", + yaz_log(YLOG_WARN, "%s: dom filter: " + "bad attribute %s for ", tinfo->fname, attr->name); } if (name_str) @@ -728,8 +750,8 @@ static void index_record(struct filter_info *tinfo,struct recExtractCtrl *ctrl, else if (attr_content(attr, "rank", &rank_str)) ; else - yaz_log(YLOG_WARN, "%s: dom filter: bad attribute %s" - " for ", + yaz_log(YLOG_WARN, "%s: dom filter: " + "bad attribute %s for ", tinfo->fname, attr->name); } if (id_str) @@ -743,16 +765,18 @@ static void index_record(struct filter_info *tinfo,struct recExtractCtrl *ctrl, if (!strcmp("update", type_str)) index_node(tinfo, ctrl, ptr, recWord); else if (!strcmp("delete", type_str)) - yaz_log(YLOG_WARN, "dom filter delete: to be implemented"); + yaz_log(YLOG_WARN, "%s dom filter: " + "delete: to be implemented"); else - yaz_log(YLOG_WARN, "dom filter: unknown record type '%s'", + yaz_log(YLOG_WARN, "dom filter: " + "unknown record type '%s'", type_str); } /* Alvis style indexing */ static void extract_doc_alvis(struct filter_info *tinfo, - struct recExtractCtrl *recctr, + struct recExtractCtrl *extctr, xmlDocPtr doc) { if (doc){ @@ -761,18 +785,19 @@ static void extract_doc_alvis(struct filter_info *tinfo, int len_out; xmlNodePtr root_ptr; - (*recctr->init)(recctr, &recWord); + (*extctr->init)(extctr, &recWord); - if (recctr->flagShowRecords){ + if (extctr->flagShowRecords){ xmlDocDumpMemory(doc, &buf_out, &len_out); fwrite(buf_out, len_out, 1, stdout); xmlFree(buf_out); } root_ptr = xmlDocGetRootElement(doc); if (root_ptr) - index_record(tinfo, recctr, root_ptr, &recWord); + index_record(tinfo, extctr, root_ptr, &recWord); else - yaz_log(YLOG_WARN, "No root for index XML record"); + yaz_log(YLOG_WARN, "%s dom filter: " + "No root for index XML record"); } } @@ -790,96 +815,120 @@ static int attr_content_xml(struct _xmlAttr *attr, const char *name, return 0; } -/* DOM filter style indexing */ -/* #define ZEBRA_XSLT_NS "http://indexdata.com/zebra-2.0" */ -/* static const char *zebra_xslt_ns = ZEBRA_XSLT_NS; */ - -/* DOM filter style indexing */ -#define ZEBRA_PI_NAME "zebra-2.0" -static const char *zebra_pi_name = ZEBRA_PI_NAME; - /* DOM filter style indexing */ static void index_value_of(struct filter_info *tinfo, - struct recExtractCtrl *recctr, + struct recExtractCtrl *extctr, xmlNodePtr node, xmlChar * index_p) { xmlChar *text = xmlNodeGetContent(node); + size_t text_len = strlen((const char *)text); + - xmlChar *look = index_p; - xmlChar *bval; - xmlChar *eval; + /* if there is no text, we do not need to proceed */ + if (text_len) + { + xmlChar *look = index_p; + xmlChar *bval; + xmlChar *eval; + + xmlChar index[256]; + xmlChar type[256]; - xmlChar index[256]; - xmlChar type[256]; + /* assingning text to be indexed */ + RecWord recWord; + (*extctr->init)(extctr, &recWord); + recWord.term_buf = (const char *)text; + recWord.term_len = text_len; - /* parsing all index name/type pairs - may not start with ' ' or ':' */ - while (*look && ' ' != *look && ':' != *look){ + /* parsing all index name/type pairs */ + /* may not start with ' ' or ':' */ + while (*look && ' ' != *look && ':' != *look){ - /* setting name and type to zero */ - *index = '\0'; - *type = '\0'; + /* setting name and type to zero */ + *index = '\0'; + *type = '\0'; - /* parsing one index name */ - bval = look; - while (*look && ':' != *look && ' ' != *look){ - look++; - } - eval = look; - strncpy((char *)index, (const char *)bval, eval - bval); - index[eval - bval] = '\0'; + /* parsing one index name */ + bval = look; + while (*look && ':' != *look && ' ' != *look){ + look++; + } + eval = look; + strncpy((char *)index, (const char *)bval, eval - bval); + index[eval - bval] = '\0'; - /* parsing one index type, if existing */ - if (':' == *look){ - look++; + /* parsing one index type, if existing */ + if (':' == *look){ + look++; - bval = look; - while (*look && ' ' != *look){ - look++; - } - eval = look; - strncpy((char *)type, (const char *)bval, eval - bval); - type[eval - bval] = '\0'; - } + bval = look; + while (*look && ' ' != *look){ + look++; + } + eval = look; + strncpy((char *)type, (const char *)bval, eval - bval); + type[eval - bval] = '\0'; + } - printf("INDEX '%s:%s' '%s'\n", index, type, text); - - if (*look && ' ' == *look && *(look+1)){ - look++; - } - } + /* actually indexing the text given */ + yaz_log(YLOG_DEBUG, "%s dom filter: " + "INDEX '%s:%s' '%s'", + tinfo->fname, index, type, text); - xmlFree(text); + recWord.index_name = (const char *)index; + if (type && *type) + recWord.index_type = *type; + (extctr->tokenAdd)(&recWord); - /* //recWord->term_buf = (const char *)ptr->content; */ - /* //recWord->term_len = XML_STRLEN(ptr->content); */ - /* // if (type_str && *type_str) */ - /* // recWord->index_type = *type_str; /\* type was given *\/ */ - /* // recWord->index_name = name_str; */ - /* // recWord->index_type = prev_type; /\* restore it again *\/ */ + /* eat whitespaces */ + if (*look && ' ' == *look && *(look+1)){ + look++; + } + } + } + + xmlFree(text); } /* DOM filter style indexing */ static void set_record_info(struct filter_info *tinfo, - struct recExtractCtrl *recctr, + struct recExtractCtrl *extctr, xmlChar * id_p, xmlChar * rank_p, xmlChar * type_p) { - printf("RECORD id=%s rank=%s type=%s\n", id_p, rank_p, type_p); + yaz_log(YLOG_DEBUG, "%s dom filter: " + "RECORD id=%s rank=%s type=%s", + tinfo->fname, id_p, rank_p, type_p); + + if (id_p) + sscanf((const char *)id_p, "%255s", extctr->match_criteria); + + if (rank_p) + extctr->staticrank = atozint((const char *)rank_p); + + /* if (!strcmp("update", type_str)) */ + /* index_node(tinfo, ctrl, ptr, recWord); */ + /* else if (!strcmp("delete", type_str)) */ + /* yaz_log(YLOG_WARN, "dom filter delete: to be implemented"); */ + /* else */ + /* yaz_log(YLOG_WARN, "dom filter: unknown record type '%s'", */ + /* type_str); */ + } /* DOM filter style indexing */ static void process_xml_element_zebra_node(struct filter_info *tinfo, - struct recExtractCtrl *recctr, + struct recExtractCtrl *extctr, xmlNodePtr node) { if (node->type == XML_ELEMENT_NODE - && node->ns && 0 == XML_STRCMP(node->ns->href, zebra_xslt_ns)){ + && node->ns && 0 == XML_STRCMP(node->ns->href, zebra_dom_ns)){ if (0 == XML_STRCMP(node->name, "index")){ xmlChar *index_p = 0; @@ -887,14 +936,12 @@ static void process_xml_element_zebra_node(struct filter_info *tinfo, struct _xmlAttr *attr; for (attr = node->properties; attr; attr = attr->next){ if (attr_content_xml(attr, "name", &index_p)){ - index_value_of(tinfo, recctr, node, index_p); + index_value_of(tinfo, extctr, node, index_p); } else - // printf("%s: dom filter: s% bad attribute %s", - // tinfo->fname, xmlGetNodePath(node)), nodeattr->name); - printf("dom filter: %s bad attribute @%s, " - "expected @name\n", - xmlGetNodePath(node), attr->name); + yaz_log(YLOG_WARN,"%s dom filter: " + "%s bad attribute @%s, expected @name", + tinfo->fname, xmlGetNodePath(node), attr->name); } } else if (0 == XML_STRCMP(node->name, "record")){ @@ -909,28 +956,28 @@ static void process_xml_element_zebra_node(struct filter_info *tinfo, else if (attr_content_xml(attr, "rank", &rank_p)) ; else if (attr_content_xml(attr, "type", &type_p)) - ; + ; else - // printf("%s: dom filter: s% bad attribute %s", - // tinfo->fname, xmlGetNodePath(node)), nodeattr->name); - printf("dom filter: %s bad attribute @%s," - " expected @id|@rank|@type\n", - xmlGetNodePath(node), attr->name); + yaz_log(YLOG_WARN,"%s dom filter: " + "%s bad attribute @%s," + " expected @id|@rank|@type", + tinfo->fname, xmlGetNodePath(node), attr->name); if (type_p && 0 != strcmp("update", (const char *)type_p)) - printf("dom filter: %s attribute @%s," - " only implemented '@type=\"update\"\n", - xmlGetNodePath(node), attr->name); + yaz_log(YLOG_WARN,"%s dom filter: " + "%s attribute @%s," + " only implemented '@type='update'", + tinfo->fname, xmlGetNodePath(node), attr->name); } - set_record_info(tinfo, recctr, id_p, rank_p, type_p); + set_record_info(tinfo, extctr, id_p, rank_p, type_p); } else { - // printf("%s: dom filter: s% bad attribute %s", - // tinfo->fname, xmlGetNodePath(node)), nodeattr->name); - printf("dom filter: %s bad element <%s>," - " expected | in namespace '%s'\n", - xmlGetNodePath(node), node->name, zebra_xslt_ns); + yaz_log(YLOG_WARN,"%s dom filter: " + "%s bad element <%s>," + " expected | in namespace '%s'", + tinfo->fname, xmlGetNodePath(node), + node->name, zebra_dom_ns); } } @@ -939,12 +986,12 @@ static void process_xml_element_zebra_node(struct filter_info *tinfo, /* DOM filter style indexing */ static void process_xml_pi_node(struct filter_info *tinfo, - struct recExtractCtrl *recctr, + struct recExtractCtrl *extctr, xmlNodePtr node, xmlChar **index_pp) { - /* printf("PI %s\n", xmlGetNodePath(node)); */ + /* yaz_log(YLOG_DEBUG,"PI %s\n", xmlGetNodePath(node)); */ /* if right PI name, continue parsing PI */ if (0 == strcmp(zebra_pi_name, (const char *)node->name)){ @@ -1000,13 +1047,12 @@ static void process_xml_pi_node(struct filter_info *tinfo, while (*look && ' ' == *look && *(look+1)) look++; - if (look && '\0' != *look){ - printf ("ERROR %s: content '%s'; can not parse '%s'\n", - xmlGetNodePath(node), pi_p, look); - } else { - /* set_record_info(id, rank, type); */ - set_record_info(tinfo, recctr, id, rank, 0); - } + if (look && '\0' != *look) + yaz_log(YLOG_WARN,"%s dom filter: " + "%s content '%s', can not parse '%s'", + tinfo->fname, xmlGetNodePath(node), pi_p, look); + else + set_record_info(tinfo, extctr, id, rank, 0); } @@ -1020,44 +1066,42 @@ static void process_xml_pi_node(struct filter_info *tinfo, /* export index instructions to outside */ *index_pp = look; - - /* nor record, neither index */ - } else { - - printf ("ERROR %s: content '%s'; can not parse '%s'\n", - xmlGetNodePath(node), pi_p, look); - } + } + else + yaz_log(YLOG_WARN,"%s dom filter: " + "%s content '%s', can not parse '%s'", + tinfo->fname, xmlGetNodePath(node), pi_p, look); } } /* DOM filter style indexing */ static void process_xml_element_node(struct filter_info *tinfo, - struct recExtractCtrl *recctr, + struct recExtractCtrl *extctr, xmlNodePtr node) { /* remember indexing instruction from PI to next element node */ xmlChar *index_p = 0; - /* printf("ELEM %s\n", xmlGetNodePath(node)); */ + /* yaz_log(YLOG_DEBUG,"ELEM %s\n", xmlGetNodePath(node)); */ /* check if we are an element node in the special zebra namespace and either set record data or index value-of node content*/ - process_xml_element_zebra_node(tinfo, recctr, node); + process_xml_element_zebra_node(tinfo, extctr, node); /* loop through kid nodes */ for (node = node->children; node; node = node->next) { /* check and set PI record and index index instructions */ if (node->type == XML_PI_NODE){ - process_xml_pi_node(tinfo, recctr, node, &index_p); + process_xml_pi_node(tinfo, extctr, node, &index_p); } else if (node->type == XML_ELEMENT_NODE){ /* if there was a PI index instruction before this element */ if (index_p){ - index_value_of(tinfo, recctr, node, index_p); + index_value_of(tinfo, extctr, node, index_p); index_p = 0; } - process_xml_element_node(tinfo, recctr, node); + process_xml_element_node(tinfo, extctr, node); } else continue; @@ -1067,12 +1111,20 @@ static void process_xml_element_node(struct filter_info *tinfo, /* DOM filter style indexing */ static void extract_dom_doc_node(struct filter_info *tinfo, - struct recExtractCtrl *recctr, + struct recExtractCtrl *extctr, xmlDocPtr doc) { - /* printf("DOC %s\n", xmlGetNodePath((xmlNodePtr)doc)); */ + /* yaz_log(YLOG_DEBUG,"DOC %s\n", xmlGetNodePath((xmlNodePtr)doc)); */ + + xmlChar *buf_out; + int len_out; + if (extctr->flagShowRecords){ + xmlDocDumpMemory(doc, &buf_out, &len_out); + fwrite(buf_out, len_out, 1, stdout); + xmlFree(buf_out); + } - process_xml_element_node(tinfo, recctr, (xmlNodePtr)doc); + process_xml_element_node(tinfo, extctr, (xmlNodePtr)doc); } @@ -1084,7 +1136,6 @@ static int convert_extract_doc(struct filter_info *tinfo, xmlDocPtr doc) { - /* RecWord recWord; */ xmlChar *buf_out; int len_out; const char *params[10]; @@ -1092,7 +1143,7 @@ static int convert_extract_doc(struct filter_info *tinfo, xmlDocPtr store_doc = 0; params[0] = 0; - set_param_str(params, "schema", zebra_xslt_ns, tinfo->odr_record); + set_param_str(params, "schema", zebra_dom_ns, tinfo->odr_record); /* input conversion */ perform_convert(tinfo, input->convert, params, &doc, 0); @@ -1124,7 +1175,7 @@ static int convert_extract_doc(struct filter_info *tinfo, /* finally, do the indexing */ if (doc){ extract_dom_doc_node(tinfo, p, doc); - extract_doc_alvis(tinfo, p, doc); + /* extract_doc_alvis(tinfo, p, doc); */ xmlFreeDoc(doc); } @@ -1219,8 +1270,9 @@ static int extract_iso2709(struct filter_info *tinfo, { int i; - yaz_log(YLOG_WARN, "MARC: Skipping bad byte %d (0x%02X)", - *buf & 0xff, *buf & 0xff); + yaz_log(YLOG_WARN, "%s dom filter: " + "MARC: Skipping bad byte %d (0x%02X)", + tinfo->fname, *buf & 0xff, *buf & 0xff); for (i = 0; i<4; i++) buf[i] = buf[i+1]; @@ -1230,21 +1282,25 @@ static int extract_iso2709(struct filter_info *tinfo, record_length = atoi_n (buf, 5); if (record_length < 25) { - yaz_log (YLOG_WARN, "MARC record length < 25, is %d", - record_length); + yaz_log (YLOG_WARN, "%s dom filter: " + "MARC record length < 25, is %d", + tinfo->fname, record_length); return RECCTRL_EXTRACT_ERROR_GENERIC; } read_bytes = p->stream->readf(p->stream, buf+5, record_length-5); if (read_bytes < record_length-5) { - yaz_log (YLOG_WARN, "Couldn't read whole MARC record"); + yaz_log (YLOG_WARN, "%s dom filter: " + "Couldn't read whole MARC record", + tinfo->fname); return RECCTRL_EXTRACT_ERROR_GENERIC; } r = yaz_marc_read_iso2709(input->u.marc.handle, buf, record_length); if (r < record_length) { - yaz_log (YLOG_WARN, "Parsing of MARC record failed r=%d length=%d", - r, record_length); + yaz_log (YLOG_WARN, "%s dom filter: " + "Parsing of MARC record failed r=%d length=%d", + tinfo->fname, r, record_length); return RECCTRL_EXTRACT_ERROR_GENERIC; } else @@ -1295,7 +1351,7 @@ static int ioclose_ret(void *context) static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p) { - /* const char *esn = zebra_xslt_ns; */ + /* const char *esn = zebra_dom_ns; */ const char *esn = 0; const char *params[32]; struct filter_info *tinfo = clientData;