1 /* Copyright (C) 2006, Index Data ApS
2 * See the file LICENSE for details.
3 * $Id: nfaxml.h,v 1.5 2006-07-14 13:06:37 heikki Exp $
8 * \brief Routines for reading NFA specs from an XML file
10 * The xml file is something like this (using round brakcets
11 * on tags, not to confuse our documentation tools)
15 * (fromstring) FOO (/fromstring)
16 * (tostring) BAR (/tostring)
19 * (fromrange) a-z (/fromrange)
20 * (torange) A-Z (/torange)
24 * The rules consist of two parts, 'from' and 'to'.
26 * fromstring (which can be a single character)
27 * fromrange (like a-z)
28 * (later, perhaps a fromregexp)
30 * tostring (which can be a single character)
31 * torange (only with a fromrange)
32 * (later, perhaps backrefs from regexps)
40 #include <libxml/parser.h>
42 #include <yaz/yconfig.h>
48 /** \brief Parse the NFA from a XML document
50 * \param doc the xml tree to parse
51 * \param filename used for info in error messages
53 * \returns either the NFA, or null in case of errors
55 * It is up to the caller to destroy the nfa when done.
57 * Does not expand XIncludes.
59 * In case of errors, returns a null pointer. You can then
60 * call xmlGetLastError() to get the details of the error,
61 * if you have a recent enough libxml2. Those are already
65 yaz_nfa *yaz_nfa_parse_xml_doc(xmlDocPtr doc, const char *filename);
68 /** \brief Parse the NFA from a file
70 * \param filepath path to the xml file to parse
71 * \param error_info will be filled in case of errors
73 * \returns either the NFA, or null in case of errors
75 * It is up to the caller to destroy the nfa when done.
77 * This routine also expands XIncludes.
79 * In case of errors, returns a null pointer. You can then
80 * call xmlGetLastError() to get the details of the error,
81 * if you have a recent enough libxml2. Those are already
85 yaz_nfa *yaz_nfa_parse_xml_file(const char *filepath);
88 /** \brief Parse the NFA from a memory buffer
90 * \param filepath path to the xml file to parse
91 * \param error_info will be filled in case of errors
93 * \returns either the NFA, or null in case of errors
95 * It is up to the caller to destroy the nfa when done.
97 * Does not expand XIncludes.
99 * In case of errors, returns a null pointer. You can then
100 * call xmlGetLastError() to get the details of the error,
101 * if you have a recent enough libxml2. Those are already
105 yaz_nfa *yaz_nfa_parse_xml_memory(const char *xmlbuff, const char *filename);
110 #endif /* YAZ_HAVE_XML2 */
111 #endif /* YAZ_NFA_XML_H */
116 * indent-tabs-mode: nil
118 * vim: shiftwidth=4 tabstop=8 expandtab