39 #ifndef vpXmlParser_HH
40 #define vpXmlParser_HH
42 #include <visp3/core/vpConfig.h>
46 #include <visp3/core/vpException.h>
48 #include <libxml/parser.h>
177 class VISP_EXPORT vpXmlParser
192 virtual void readMainClass(xmlDocPtr doc, xmlNodePtr node) = 0;
203 virtual void writeMainClass(xmlNodePtr node) = 0;
205 bool xmlReadBoolChild(xmlDocPtr doc, xmlNodePtr node);
206 char *xmlReadCharChild(xmlDocPtr doc, xmlNodePtr node);
207 double xmlReadDoubleChild(xmlDocPtr doc, xmlNodePtr node);
208 float xmlReadFloatChild(xmlDocPtr doc, xmlNodePtr node);
209 int xmlReadIntChild(xmlDocPtr doc, xmlNodePtr node);
210 std::string xmlReadStringChild(xmlDocPtr doc, xmlNodePtr node);
211 unsigned int xmlReadUnsignedIntChild(xmlDocPtr doc, xmlNodePtr node);
213 void xmlWriteBoolChild(xmlNodePtr node,
const char *label,
bool value);
214 void xmlWriteCharChild(xmlNodePtr node,
const char *label,
const char *value);
215 void xmlWriteDoubleChild(xmlNodePtr node,
const char *label,
double value);
216 void xmlWriteFloatChild(xmlNodePtr node,
const char *label,
float value);
217 void xmlWriteIntChild(xmlNodePtr node,
const char *label,
int value);
218 void xmlWriteStringChild(xmlNodePtr node,
const char *label,
const std::string &value);
219 void xmlWriteUnsignedIntChild(xmlNodePtr node,
const char *label,
unsigned int value);
226 std::map<std::string, int> nodeMap;
231 std::string main_tag;
237 vpXmlParser(
const vpXmlParser &_twin);
238 virtual ~vpXmlParser();
240 void parse(
const std::string &filename);
241 void save(
const std::string &filename,
bool append =
false);
286 void setMap(
const std::map<std::string, int> &_map) { nodeMap = _map; }
295 inline void setMainTag(
const std::string &tag) { main_tag = tag; }
310 static void cleanup() { xmlCleanupParser(); }