Fixed order of declarations
[yaz-moved-to-github.git] / src / nfaxml.c
1 /*  Copyright (C) 2006, Index Data ApS
2  *  See the file LICENSE for details.
3  * 
4  *  $Id: nfaxml.c,v 1.8 2006-07-06 14:06:17 heikki Exp $ 
5  */
6
7 /**
8  * \file nfaxml.c
9  * \brief Routines for reading a NFA spec from an XML file
10  *
11  */
12
13 #if YAZ_HAVE_XML2
14
15 #include <string.h>
16
17 /* #include <libxml/parser.h> */
18 #include <libxml/tree.h>
19 #include <libxml/xinclude.h>
20
21 #include <yaz/nfa.h>
22 #include <yaz/nmem.h> 
23 #include <yaz/yconfig.h>
24 #include <yaz/nfa.h>
25 #include <yaz/nfaxml.h>
26 #include <yaz/libxml2_error.h>
27
28 /** \brief Parse the NFA from a XML document 
29  */
30 yaz_nfa *yaz_nfa_parse_xml_doc(xmlDocPtr doc)
31 {
32     libxml2_error_to_yazlog(YLOG_FATAL, "yaz_nfa_parse_doc");
33
34     if (!doc)
35         return 0;
36
37     return 0;
38 }
39
40
41 /** \brief Parse the NFA from a file 
42  */
43 yaz_nfa *yaz_nfa_parse_xml_file(const char *filepath) {
44     int nSubst;
45
46     xmlDocPtr doc;
47     libxml2_error_to_yazlog(YLOG_FATAL, "yaz_nfa_parse_xml_file");
48
49     doc = xmlParseFile(filepath);
50     if (!doc) {
51         return 0;
52     }
53     nSubst=xmlXIncludeProcess(doc);
54     if (nSubst==-1) {
55         return 0;
56     }
57     return yaz_nfa_parse_xml_doc(doc);
58 }
59
60 /** \brief Parse the NFA from a memory buffer
61  */
62 yaz_nfa *yaz_nfa_parse_xml_memory(const char *xmlbuff) {
63     xmlDocPtr doc;
64     libxml2_error_to_yazlog(YLOG_FATAL, "yaz_nfa_parse_xml_memory");
65     doc = xmlParseMemory(xmlbuff, strlen(xmlbuff));
66     return yaz_nfa_parse_xml_doc(doc);
67 }
68
69
70
71 #endif /* YAZ_HAVE_XML2 */
72
73
74 /*
75  * Local variables:
76  * c-basic-offset: 4
77  * indent-tabs-mode: nil
78  * End:
79  * vim: shiftwidth=4 tabstop=8 expandtab
80  */