Fix compilation on systems where Libxml2 does not exist
[yaz-moved-to-github.git] / include / yaz / nfaxml.h
1 /*  Copyright (C) 2006, Index Data ApS
2  *  See the file LICENSE for details.
3  *  $Id: nfaxml.h,v 1.3 2006-07-06 07:45:07 adam Exp $
4  */
5
6 /**
7  * \file nfaxml.h
8  * \brief Routines for reading NFA specs from an XML file
9  *
10  * The xml file is something like this (using round brakcets 
11  * on tags, not to confuse our documentation tools)
12  *   (?xml ...)
13  *   (charmap)
14  *      (rule)
15  *         (fromstring) FOO (/fromstring)
16  *         (tostring)   BAR (/tostring)
17  *      (/rule)
18  *      (rule)
19  *         (fromrange) a-z (/fromrange)
20  *         (torange)   A-Z (/torange)
21  *      (/rule)
22  *      ...
23  *
24  *  The rules consist of two parts, 'from' and 'to'.
25  *  From rules can be
26  *     fromstring (which can be a single character)
27  *     fromrange  (like a-z)
28  *     (later, perhaps a fromregexp)
29  *  To rules can be
30  *     tostring (which can be a single character)
31  *     torange  (only with a fromrange)
32  *     (later, perhaps backrefs from regexps)
33  */
34
35 #ifndef YAZ_NFA_XML_H
36 #define YAZ_NFA_XML_H
37
38 #include <yaz/yconfig.h>
39 #include <yaz/log.h>
40 #include <yaz/nfa.h>
41
42 YAZ_BEGIN_CDECL
43
44 /** \brief Parse the NFA from a XML document 
45  * 
46  * \param doc the xml tree to parse
47  * \param error_info will be filled in case of errors
48  * 
49  * \returns either the NFA, or null in case of errors 
50  *
51  * It is up to the caller to destroy the nfa when done.
52  *
53  * In case of errors, returns a null pointer.  You can then
54  * call xmlGetLastError() to get the details of the error. 
55  *
56  */
57 yaz_nfa *yaz_nfa_parse_xml_doc(void *xmlDocPtr);
58
59
60 /** \brief Parse the NFA from a file 
61  *
62  * \param filepath path to the xml file to parse
63  * \param error_info will be filled in case of errors
64  * 
65  * \returns either the NFA, or null in case of errors 
66  *
67  * It is up to the caller to destroy the nfa when done.
68  *
69  * In case of errors, error_info will be filled with
70  * suitable diagnostics. It may be null, if you don't
71  * care.
72  *
73  */
74 yaz_nfa *yaz_nfa_parse_xml_file(const char *filepath);
75
76
77 YAZ_END_CDECL
78
79 #endif /* YAZ_NFA_XML_H */
80
81 /*
82  * Local variables:
83  * c-basic-offset: 4
84  * indent-tabs-mode: nil
85  * End:
86  * vim: shiftwidth=4 tabstop=8 expandtab
87  */
88