X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fnfaxml.c;fp=src%2Fnfaxml.c;h=a573eee4041c3d79cb536f28d536c28574361201;hb=fb61309506b52ca0dad9aea4135ceeda63707b0d;hp=0000000000000000000000000000000000000000;hpb=acf66fb3406fb7eb3e8c76cbe073cbe061080a5a;p=yaz-moved-to-github.git diff --git a/src/nfaxml.c b/src/nfaxml.c new file mode 100644 index 0000000..a573eee --- /dev/null +++ b/src/nfaxml.c @@ -0,0 +1,87 @@ +/* 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 $ + */ + +/** + * \file nfaxml.c + * \brief Routines for reading a NFA spec from an XML file + * + */ + +#if HAVE_XML2 + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + + + + +/** \brief Log XML errors in yaz_log + * + */ + +static void log_xml_error(int errlevel, char *msg) { + xmlErrorPtr e=xmlGetLastError(); + if (!e) /* no error happened */ + 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", + 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; +} + + +/** \brief Parse the NFA from a file + */ +yaz_nfa *yaz_nfa_parse_xml_file(char *filepath) { + int nSubst; + 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); +} + + + +#endif /* HAVE_XML2 */ + + +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */