39 #ifndef VP_XML_PARSER_H
40 #define VP_XML_PARSER_H
42 #include <visp3/core/vpConfig.h>
46 #include <visp3/core/vpException.h>
56 typedef _xmlDoc xmlDoc;
57 typedef xmlDoc *xmlDocPtr;
60 typedef _xmlNode xmlNode;
61 typedef xmlNode *xmlNodePtr;
184 class VISP_EXPORT vpXmlParser
199 virtual void readMainClass(xmlDocPtr doc, xmlNodePtr node) = 0;
210 virtual void writeMainClass(xmlNodePtr node) = 0;
212 bool xmlReadBoolChild(xmlDocPtr doc, xmlNodePtr node);
213 char *xmlReadCharChild(xmlDocPtr doc, xmlNodePtr node);
214 double xmlReadDoubleChild(xmlDocPtr doc, xmlNodePtr node);
215 float xmlReadFloatChild(xmlDocPtr doc, xmlNodePtr node);
216 int xmlReadIntChild(xmlDocPtr doc, xmlNodePtr node);
217 std::string xmlReadStringChild(xmlDocPtr doc, xmlNodePtr node);
218 unsigned int xmlReadUnsignedIntChild(xmlDocPtr doc, xmlNodePtr node);
220 void xmlWriteBoolChild(xmlNodePtr node,
const char *label,
bool value);
221 void xmlWriteCharChild(xmlNodePtr node,
const char *label,
const char *value);
222 void xmlWriteDoubleChild(xmlNodePtr node,
const char *label,
double value);
223 void xmlWriteFloatChild(xmlNodePtr node,
const char *label,
float value);
224 void xmlWriteIntChild(xmlNodePtr node,
const char *label,
int value);
225 void xmlWriteStringChild(xmlNodePtr node,
const char *label,
const std::string &value);
226 void xmlWriteUnsignedIntChild(xmlNodePtr node,
const char *label,
unsigned int value);
233 std::map<std::string, int> nodeMap;
238 std::string main_tag;
244 vpXmlParser(
const vpXmlParser &_twin);
245 virtual ~vpXmlParser();
247 void parse(
const std::string &filename);
248 void save(
const std::string &filename,
bool append =
false);
293 void setMap(
const std::map<std::string, int> &_map) { nodeMap = _map; }
302 inline void setMainTag(
const std::string &tag) { main_tag = tag; }
317 static void cleanup();