X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=index%2Fmod_grs_xml.c;h=7df0f32b8226ef8852670319cb23832f74332bc8;hp=248342b004aa50229a3f5c96adae210d21c4270d;hb=ba0720e26f508ba3396e232d2f82037c0e701698;hpb=b3679b1ecd730266f70a62347f66e5964a2fa030 diff --git a/index/mod_grs_xml.c b/index/mod_grs_xml.c index 248342b..7df0f32 100644 --- a/index/mod_grs_xml.c +++ b/index/mod_grs_xml.c @@ -1,5 +1,5 @@ /* This file is part of the Zebra server. - Copyright (C) 1995-2008 Index Data + Copyright (C) 1994-2011 Index Data Zebra is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -17,6 +17,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#if HAVE_CONFIG_H +#include +#endif #if HAVE_EXPAT_H #include @@ -46,6 +49,14 @@ struct user_info { int loglevel; }; +static void report_xml_error(XML_Parser parser) +{ + zint line = XML_GetCurrentLineNumber(parser); + zint col = XML_GetCurrentColumnNumber(parser); + yaz_log (YLOG_WARN, ZINT_FORMAT ":" ZINT_FORMAT ":XML error: %s", + line, col, XML_ErrorString(XML_GetErrorCode(parser))); +} + static void cb_start (void *user, const char *el, const char **attr) { struct user_info *ui = (struct user_info*) user; @@ -199,11 +210,7 @@ static int cb_external_entity(XML_Parser pparser, if (!XML_ParseBuffer (parser, r, done)) { done = 1; - yaz_log (YLOG_WARN, "%s:%d:%d:XML error: %s", - systemId, - XML_GetCurrentLineNumber(parser), - XML_GetCurrentColumnNumber(parser), - XML_ErrorString(XML_GetErrorCode(parser))); + report_xml_error(parser); } } fclose (inf); @@ -446,10 +453,7 @@ data1_node *zebra_read_xml(data1_handle dh, if (no_read && !XML_ParseBuffer (parser, r, done)) { done = 1; - yaz_log (YLOG_WARN, "%d:%d:XML error: %s", - XML_GetCurrentLineNumber(parser), - XML_GetCurrentColumnNumber(parser), - XML_ErrorString(XML_GetErrorCode(parser))); + report_xml_error(parser); } } XML_ParserFree (parser); @@ -524,7 +528,7 @@ static struct recType filter_type = { }; RecType -#ifdef IDZEBRA_STATIC_GRS_XML +#if IDZEBRA_STATIC_GRS_XML idzebra_filter_grs_xml #else idzebra_filter @@ -540,6 +544,7 @@ idzebra_filter /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab