Robotran C Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
mbs_xml.h
Go to the documentation of this file.
1 
13 #ifndef MBS_XML_h
14 #define MBS_XML_h
15 #include <stdlib.h>
16 #include "mbs_message.h"
17 
18 #ifdef XML_FOUND
19 #include <libxml/tree.h>
20 #include <libxml/parser.h>
21 
22 #else
23 #define XML_ERR ">> XML>> "
24 #define XML_PRE " >> "
25 
26 // Required typedef
27 typedef struct _xmlDoc xmlDoc;
28 typedef xmlDoc *xmlDocPtr;
29 
30 typedef struct _xmlNode xmlNode;
31 typedef xmlNode *xmlNodePtr;
32 
33 typedef struct _xmlAttr xmlAttr;
34 typedef xmlAttr *xmlAttrPtr;
35 
36 typedef struct _xmlNs xmlNs;
37 typedef xmlNs *xmlNsPtr;
38 
39 typedef unsigned char xmlChar;
40 
41 typedef struct _xmlError xmlError;
42 typedef xmlError *xmlErrorPtr;
43 
44 typedef enum
45 {
68 
69 // Minimum structure members
70 struct _xmlNode {
72  const xmlChar *name;
73  struct _xmlNode *children;
74  struct _xmlNode *parent;
75  struct _xmlNode *next;
76  struct _xmlDoc *doc;
78 };
79 struct _xmlAttr {
81  const xmlChar *name;
82  struct _xmlNode *children;
83  struct _xmlAttr *next;
84  struct _xmlDoc *doc;
85 };
86 struct _xmlError {
87  int code;
88  char *message;
89 };
90 
91 // Minimum required macro
92 #ifndef xmlChildrenNode
93 #define xmlChildrenNode children
94 #endif
95 
96 #define BAD_CAST (xmlChar *)
97 #define XML_ERR_INVALID_CHAR 9
98 #define XML_IO_LOAD_ERROR 1549
99 
100 static inline int xmlSaveFormatFile(const char *filename, xmlDocPtr cur, int format)
101 {
102  mbs_msg(XML_ERR"%s()\n"
103  XML_PRE"Code compiled without XML library.\n"
104  XML_PRE"To use this module, compile MBsysC with XML library.\n",
105  __func__);
106  return -1;
107 }
108 
109 static inline xmlChar *xmlNodeListGetString(xmlDocPtr doc, const xmlNode *list, int inLine)
110 {
111  mbs_msg(XML_ERR"%s()\n"
112  XML_PRE"Code compiled without XML library.\n"
113  XML_PRE"To use this module, compile MBsysC with XML library.\n",
114  __func__);
115  return NULL;
116 }
117 
118 static inline void xmlFree(xmlChar *xml)
119 {
120  mbs_msg(XML_ERR"%s()\n"
121  XML_PRE"Code compiled without XML library.\n"
122  XML_PRE"To use this module, compile MBsysC with XML library.\n",
123  __func__);
124 }
125 
126 static inline xmlChar *xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input)
127 {
128  mbs_msg(XML_ERR"%s()\n"
129  XML_PRE"Code compiled without XML library.\n"
130  XML_PRE"To use this module, compile MBsysC with XML library.\n",
131  __func__);
132  return NULL;
133 }
134 
135 static inline void xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content)
136 {
137  mbs_msg(XML_ERR"%s()\n"
138  XML_PRE"Code compiled without XML library.\n"
139  XML_PRE"To use this module, compile MBsysC with XML library.\n",
140  __func__);
141 }
142 
144  const xmlChar *name, const xmlChar *content)
145 {
146  mbs_msg(XML_ERR"%s()\n"
147  XML_PRE"Code compiled without XML library.\n"
148  XML_PRE"To use this module, compile MBsysC with XML library.\n",
149  __func__);
150  return NULL;
151 }
152 
153 static inline xmlNodePtr xmlAddChild(xmlNodePtr parent, xmlNodePtr cur)
154 {
155  mbs_msg(XML_ERR"%s()\n"
156  XML_PRE"Code compiled without XML library.\n"
157  XML_PRE"To use this module, compile MBsysC with XML library.\n",
158  __func__);
159  return NULL;
160 }
161 
162 static inline xmlAttrPtr xmlSetProp(xmlNodePtr node, const xmlChar *name,
163  const xmlChar *value)
164 {
165  mbs_msg(XML_ERR"%s()\n"
166  XML_PRE"Code compiled without XML library.\n"
167  XML_PRE"To use this module, compile MBsysC with XML library.\n",
168  __func__);
169  return NULL;
170 }
171 
172 static inline xmlNodePtr xmlDocGetRootElement(const xmlDoc *doc)
173 {
174  mbs_msg(XML_ERR"%s()\n"
175  XML_PRE"Code compiled without XML library.\n"
176  XML_PRE"To use this module, compile MBsysC with XML library.\n",
177  __func__);
178  return NULL;
179 }
180 
182 {
183  mbs_msg(XML_ERR"%s()\n"
184  XML_PRE"Code compiled without XML library.\n"
185  XML_PRE"To use this module, compile MBsysC with XML library.\n",
186  __func__);
187  return NULL;
188 }
189 
190 static inline int xmlKeepBlanksDefault(int val)
191 {
192  mbs_msg(XML_ERR"%s()\n"
193  XML_PRE"Code compiled without XML library.\n"
194  XML_PRE"To use this module, compile MBsysC with XML library.\n",
195  __func__);
196  return -1;
197 }
198 
199 static inline xmlDocPtr xmlParseFile(const char *filename)
200 {
201  mbs_msg(XML_ERR"%s()\n"
202  XML_PRE"Code compiled without XML library.\n"
203  XML_PRE"To use this module, compile MBsysC with XML library.\n",
204  __func__);
205  return NULL;
206 }
207 
208 static inline xmlErrorPtr xmlGetLastError(void)
209 {
210  mbs_msg(XML_ERR"%s()\n"
211  XML_PRE"Code compiled without XML library.\n"
212  XML_PRE"To use this module, compile MBsysC with XML library.\n",
213  __func__);
214  return NULL;
215 }
216 
217 static inline void xmlFreeDoc(xmlDocPtr cur)
218 {
219  mbs_msg(XML_ERR"%s()\n"
220  XML_PRE"Code compiled without XML library.\n"
221  XML_PRE"To use this module, compile MBsysC with XML library.\n",
222  __func__);
223 }
224 
225 static inline void xmlFreeNode(xmlNodePtr cur)
226 {
227  mbs_msg(XML_ERR"%s()\n"
228  XML_PRE"Code compiled without XML library.\n"
229  XML_PRE"To use this module, compile MBsysC with XML library.\n",
230  __func__);
231 }
232 
233 static inline void xmlUnlinkNode(xmlNodePtr cur)
234 {
235  mbs_msg(XML_ERR"%s()\n"
236  XML_PRE"Code compiled without XML library.\n"
237  XML_PRE"To use this module, compile MBsysC with XML library.\n",
238  __func__);
239 }
240 #endif
241 
242 #endif
XML_PRE
#define XML_PRE
Definition: mbs_xml.h:24
XML_ENTITY_NODE
@ XML_ENTITY_NODE
Definition: mbs_xml.h:51
_xmlAttr::children
struct _xmlNode * children
Definition: mbs_xml.h:82
mbs_msg
void mbs_msg(const char *msg,...)
Send a message.
Definition: mbs_message.c:87
_xmlNode::properties
struct _xmlAttr * properties
Definition: mbs_xml.h:77
_xmlAttr
Definition: mbs_xml.h:79
xmlNodeListGetString
static xmlChar * xmlNodeListGetString(xmlDocPtr doc, const xmlNode *list, int inLine)
Definition: mbs_xml.h:109
XML_XINCLUDE_END
@ XML_XINCLUDE_END
Definition: mbs_xml.h:65
xmlChar
unsigned char xmlChar
Definition: mbs_xml.h:39
xmlNs
struct _xmlNs xmlNs
Definition: mbs_xml.h:36
xmlSetProp
static xmlAttrPtr xmlSetProp(xmlNodePtr node, const xmlChar *name, const xmlChar *value)
Definition: mbs_xml.h:162
xmlFreeDoc
static void xmlFreeDoc(xmlDocPtr cur)
Definition: mbs_xml.h:217
_xmlError::code
int code
Definition: mbs_xml.h:87
xmlParseFile
static xmlDocPtr xmlParseFile(const char *filename)
Definition: mbs_xml.h:199
xmlNsPtr
xmlNs * xmlNsPtr
Definition: mbs_xml.h:37
_xmlAttr::doc
struct _xmlDoc * doc
Definition: mbs_xml.h:84
xmlElementType
xmlElementType
Definition: mbs_xml.h:44
XML_HTML_DOCUMENT_NODE
@ XML_HTML_DOCUMENT_NODE
Definition: mbs_xml.h:58
xmlEncodeEntitiesReentrant
static xmlChar * xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input)
Definition: mbs_xml.h:126
_xmlError::message
char * message
Definition: mbs_xml.h:88
xmlDocPtr
xmlDoc * xmlDocPtr
Definition: mbs_xml.h:28
XML_ATTRIBUTE_NODE
@ XML_ATTRIBUTE_NODE
Definition: mbs_xml.h:47
_xmlNode::name
const xmlChar * name
Definition: mbs_xml.h:72
_xmlNode
Definition: mbs_xml.h:70
xmlNodePtr
xmlNode * xmlNodePtr
Definition: mbs_xml.h:31
xmlKeepBlanksDefault
static int xmlKeepBlanksDefault(int val)
Definition: mbs_xml.h:190
XML_NOTATION_NODE
@ XML_NOTATION_NODE
Definition: mbs_xml.h:57
xmlDoc
struct _xmlDoc xmlDoc
Definition: mbs_xml.h:27
XML_ERR
#define XML_ERR
Definition: mbs_xml.h:23
xmlErrorPtr
xmlError * xmlErrorPtr
Definition: mbs_xml.h:42
_xmlError
Definition: mbs_xml.h:86
XML_COMMENT_NODE
@ XML_COMMENT_NODE
Definition: mbs_xml.h:53
xmlFree
static void xmlFree(xmlChar *xml)
Definition: mbs_xml.h:118
xmlDocGetRootElement
static xmlNodePtr xmlDocGetRootElement(const xmlDoc *doc)
Definition: mbs_xml.h:172
_xmlAttr::name
const xmlChar * name
Definition: mbs_xml.h:81
mbs_message.h
xmlNodeSetContent
static void xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content)
Definition: mbs_xml.h:135
XML_DOCB_DOCUMENT_NODE
@ XML_DOCB_DOCUMENT_NODE
Definition: mbs_xml.h:66
_xmlNode::parent
struct _xmlNode * parent
Definition: mbs_xml.h:74
_xmlNode::doc
struct _xmlDoc * doc
Definition: mbs_xml.h:76
xmlGetLastError
static xmlErrorPtr xmlGetLastError(void)
Definition: mbs_xml.h:208
XML_PI_NODE
@ XML_PI_NODE
Definition: mbs_xml.h:52
_xmlAttr::next
struct _xmlAttr * next
Definition: mbs_xml.h:83
XML_DOCUMENT_FRAG_NODE
@ XML_DOCUMENT_FRAG_NODE
Definition: mbs_xml.h:56
XML_ENTITY_DECL
@ XML_ENTITY_DECL
Definition: mbs_xml.h:62
XML_ENTITY_REF_NODE
@ XML_ENTITY_REF_NODE
Definition: mbs_xml.h:50
_xmlAttr::type
xmlElementType type
Definition: mbs_xml.h:80
XML_TEXT_NODE
@ XML_TEXT_NODE
Definition: mbs_xml.h:48
XML_DOCUMENT_TYPE_NODE
@ XML_DOCUMENT_TYPE_NODE
Definition: mbs_xml.h:55
XML_XINCLUDE_START
@ XML_XINCLUDE_START
Definition: mbs_xml.h:64
xmlNewDocNode
static xmlNodePtr xmlNewDocNode(xmlDocPtr doc, xmlNsPtr ns, const xmlChar *name, const xmlChar *content)
Definition: mbs_xml.h:143
xmlAddPrevSibling
static xmlNodePtr xmlAddPrevSibling(xmlNodePtr cur, xmlNodePtr elem)
Definition: mbs_xml.h:181
xmlUnlinkNode
static void xmlUnlinkNode(xmlNodePtr cur)
Definition: mbs_xml.h:233
XML_ATTRIBUTE_DECL
@ XML_ATTRIBUTE_DECL
Definition: mbs_xml.h:61
xmlAddChild
static xmlNodePtr xmlAddChild(xmlNodePtr parent, xmlNodePtr cur)
Definition: mbs_xml.h:153
XML_CDATA_SECTION_NODE
@ XML_CDATA_SECTION_NODE
Definition: mbs_xml.h:49
_xmlNode::next
struct _xmlNode * next
Definition: mbs_xml.h:75
XML_DTD_NODE
@ XML_DTD_NODE
Definition: mbs_xml.h:59
_xmlNode::type
xmlElementType type
Definition: mbs_xml.h:71
_xmlNode::children
struct _xmlNode * children
Definition: mbs_xml.h:73
XML_ELEMENT_DECL
@ XML_ELEMENT_DECL
Definition: mbs_xml.h:60
XML_NAMESPACE_DECL
@ XML_NAMESPACE_DECL
Definition: mbs_xml.h:63
xmlSaveFormatFile
static int xmlSaveFormatFile(const char *filename, xmlDocPtr cur, int format)
Definition: mbs_xml.h:100
xmlAttrPtr
xmlAttr * xmlAttrPtr
Definition: mbs_xml.h:34
xmlFreeNode
static void xmlFreeNode(xmlNodePtr cur)
Definition: mbs_xml.h:225
XML_ELEMENT_NODE
@ XML_ELEMENT_NODE
Definition: mbs_xml.h:46
XML_DOCUMENT_NODE
@ XML_DOCUMENT_NODE
Definition: mbs_xml.h:54