1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2009 Index Data
3 * See the file LICENSE for details.
6 * \file libxml2_error.c
7 * \brief Libxml2 error handling
13 #include <yaz/snprintf.h>
14 #include <yaz/libxml2_error.h>
17 #include <libxml/xmlerror.h>
21 #include <libxslt/xsltutils.h>
24 static int libxml2_error_level = 0;
27 static void proxy_xml_error_handler(void *ctx, const char *fmt, ...)
34 yaz_vsnprintf(buf, sizeof(buf)-1, fmt, ap);
35 yaz_log(libxml2_error_level, "%s: %s", (char*) ctx, buf);
41 int libxml2_error_to_yazlog(int level, const char *lead_msg)
43 libxml2_error_level = level;
45 xmlSetGenericErrorFunc((void *) "XML", proxy_xml_error_handler);
47 xsltSetGenericErrorFunc((void *) "XSLT", proxy_xml_error_handler);
58 * indent-tabs-mode: nil
60 * vim: shiftwidth=4 tabstop=8 expandtab