From 9eb7c036e5fba056b392eb803bddb7e75382b15c Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 6 Jul 2006 06:09:12 +0000 Subject: [PATCH] Disabled log_xml_error because it doesn't work on older Libxml2 and also because YAZ already has a "catch lixml2 error" handler. --- src/nfaxml.c | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/src/nfaxml.c b/src/nfaxml.c index a573eee..71a2834 100644 --- a/src/nfaxml.c +++ b/src/nfaxml.c @@ -1,7 +1,7 @@ /* Copyright (C) 2006, Index Data ApS * See the file LICENSE for details. * - * $Id: nfaxml.c,v 1.1 2006-07-04 12:59:56 heikki Exp $ + * $Id: nfaxml.c,v 1.2 2006-07-06 06:09:12 adam Exp $ */ /** @@ -25,49 +25,47 @@ #include +/** \brief Parse the NFA from a XML document + */ +yaz_nfa *yaz_nfa_parse_xml_doc(xmlDocPtr doc){ + if (!doc) + return 0; + return 0; +} -/** \brief Log XML errors in yaz_log +/** \brief Log XML errors in yaz_log * + * Disabled because xmlErrorPtr does not exist for older Libxml2's */ - +#if 0 static void log_xml_error(int errlevel, char *msg) { xmlErrorPtr e=xmlGetLastError(); if (!e) /* no error happened */ - return; + return; if (!errlevel) errlevel=YLOG_FATAL; yaz_log(errlevel,"%s %d/%d: %s:%d: '%s' ", msg, e->domain, e->code, e->file, e->line, e->message); - if (e->str1 || e->str2 || e->str3 ) - yaz_log(errlevel,"extra info: '%s' '%s' '%s' %d %d", + if (e->str1 || e->str2 || e->str3 ) + yaz_log(errlevel,"extra info: '%s' '%s' '%s' %d %d", e->str1, e->str2, e->str3, e->int1, e->int2 ); } - -/** \brief Parse the NFA from a XML document - */ -yaz_nfa *yaz_nfa_parse_xml_doc(xmlDocPtr doc){ - if (!doc) - return 0; - - return 0; -} - +#endif /** \brief Parse the NFA from a file */ -yaz_nfa *yaz_nfa_parse_xml_file(char *filepath) { +yaz_nfa *yaz_nfa_parse_xml_file(const char *filepath) { int nSubst; + + libxml2_error_to_yazlog(YLOG_FATAL, "yaz_nfa_parse_xml_file"); + xmlDocPtr doc = xmlParseFile(filepath); if (!doc) { - log_xml_error(YLOG_FATAL, - "Error in parsing charmap file"); return 0; } nSubst=xmlXIncludeProcess(doc); if (nSubst==-1) { - log_xml_error(YLOG_FATAL, - "Error handling XIncludes in charmap file"); return 0; } return yaz_nfa_parse_xml_doc(doc); -- 1.7.10.4