X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=include%2Fyaz%2Fnfaxml.h;fp=include%2Fyaz%2Fnfaxml.h;h=582f9e7cd3ada23d3f0b95e8e93194ed58443aaa;hb=fb61309506b52ca0dad9aea4135ceeda63707b0d;hp=0000000000000000000000000000000000000000;hpb=acf66fb3406fb7eb3e8c76cbe073cbe061080a5a;p=yaz-moved-to-github.git diff --git a/include/yaz/nfaxml.h b/include/yaz/nfaxml.h new file mode 100644 index 0000000..582f9e7 --- /dev/null +++ b/include/yaz/nfaxml.h @@ -0,0 +1,95 @@ +/* Copyright (C) 2006, Index Data ApS + * See the file LICENSE for details. + * $Id: nfaxml.h,v 1.1 2006-07-04 12:59:56 heikki Exp $ + */ + +/** + * \file nfaxml.h + * \brief Routines for reading NFA specs from an XML file + * + * The xml file is something like this (using round brakcets + * on tags, not to confuse our documentation tools) + * (?xml ...) + * (charmap) + * (rule) + * (fromstring) FOO (/fromstring) + * (tostring) BAR (/tostring) + * (/rule) + * (rule) + * (fromrange) a-z (/fromrange) + * (torange) A-Z (/torange) + * (/rule) + * ... + * + * The rules consist of two parts, 'from' and 'to'. + * From rules can be + * fromstring (which can be a single character) + * fromrange (like a-z) + * (later, perhaps a fromregexp) + * To rules can be + * tostring (which can be a single character) + * torange (only with a fromrange) + * (later, perhaps backrefs from regexps) + */ + +#ifndef YAZ_NFA_XML_H +#define YAZ_NFA_XML_H + +#include +#include +#include + +#if HAVE_XML2 +#include + +YAZ_BEGIN_CDECL + + + +/** \brief Parse the NFA from a XML document + * + * \param doc the xml tree to parse + * \param error_info will be filled in case of errors + * + * \returns either the NFA, or null in case of errors + * + * It is up to the caller to destroy the nfa when done. + * + * In case of errors, returns a null pointer. You can then + * call xmlGetLastError() to get the details of the error. + * + */ +yaz_nfa *yaz_nfa_parse_xml_doc(xmlDocPtr doc); + + +/** \brief Parse the NFA from a file + * + * \param filepath path to the xml file to parse + * \param error_info will be filled in case of errors + * + * \returns either the NFA, or null in case of errors + * + * It is up to the caller to destroy the nfa when done. + * + * In case of errors, error_info will be filled with + * suitable diagnostics. It may be null, if you don't + * care. + * + */ +yaz_nfa *yaz_nfa_parse_xml_file(char *filepath); + + +YAZ_END_CDECL + +#endif /* HAVE_XML2 */ + +#endif /* YAZ_NFA_XML_H */ + +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +