2 * Copyright (c) 1995-2006, Index Data
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of Index Data nor the names of its contributors
13 * may be used to endorse or promote products derived from this
14 * software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 /* $Id: nfaxml.h,v 1.6 2006-10-09 21:02:41 adam Exp $ */
31 * \brief Routines for reading NFA specs from an XML file
33 * The xml file is something like this (using round brakcets
34 * on tags, not to confuse our documentation tools)
38 * (fromstring) FOO (/fromstring)
39 * (tostring) BAR (/tostring)
42 * (fromrange) a-z (/fromrange)
43 * (torange) A-Z (/torange)
47 * The rules consist of two parts, 'from' and 'to'.
49 * fromstring (which can be a single character)
50 * fromrange (like a-z)
51 * (later, perhaps a fromregexp)
53 * tostring (which can be a single character)
54 * torange (only with a fromrange)
55 * (later, perhaps backrefs from regexps)
63 #include <libxml/parser.h>
65 #include <yaz/yconfig.h>
71 /** \brief Parse the NFA from a XML document
73 * \param doc the xml tree to parse
74 * \param filename used for info in error messages
76 * \returns either the NFA, or null in case of errors
78 * It is up to the caller to destroy the nfa when done.
80 * Does not expand XIncludes.
82 * In case of errors, returns a null pointer. You can then
83 * call xmlGetLastError() to get the details of the error,
84 * if you have a recent enough libxml2. Those are already
88 yaz_nfa *yaz_nfa_parse_xml_doc(xmlDocPtr doc, const char *filename);
91 /** \brief Parse the NFA from a file
93 * \param filepath path to the xml file to parse
94 * \param error_info will be filled in case of errors
96 * \returns either the NFA, or null in case of errors
98 * It is up to the caller to destroy the nfa when done.
100 * This routine also expands XIncludes.
102 * In case of errors, returns a null pointer. You can then
103 * call xmlGetLastError() to get the details of the error,
104 * if you have a recent enough libxml2. Those are already
108 yaz_nfa *yaz_nfa_parse_xml_file(const char *filepath);
111 /** \brief Parse the NFA from a memory buffer
113 * \param filepath path to the xml file to parse
114 * \param error_info will be filled in case of errors
116 * \returns either the NFA, or null in case of errors
118 * It is up to the caller to destroy the nfa when done.
120 * Does not expand XIncludes.
122 * In case of errors, returns a null pointer. You can then
123 * call xmlGetLastError() to get the details of the error,
124 * if you have a recent enough libxml2. Those are already
128 yaz_nfa *yaz_nfa_parse_xml_memory(const char *xmlbuff, const char *filename);
133 #endif /* YAZ_HAVE_XML2 */
134 #endif /* YAZ_NFA_XML_H */
139 * indent-tabs-mode: nil
141 * vim: shiftwidth=4 tabstop=8 expandtab