4 * Created on: Mar 14, 2014
8 #ifndef CONFIG_XMLREADER_H_
9 #define CONFIG_XMLREADER_H_
16 //>> Forward declaration of xmlNodePtr.
17 typedef struct _xmlNode xmlNode;
18 typedef xmlNode *xmlNodePtr;
22 //>> Forward declaration of xmlDocPtr.
23 typedef struct _xmlDoc xmlDoc;
24 typedef xmlDoc *xmlDocPtr;
29 * Base class for all libxml readers. Provides high-level API
30 * for all xml operations.
33 class Config_XMLReader
36 CONFIG_EXPORT Config_XMLReader(const std::string& theXmlFile);
37 CONFIG_EXPORT virtual ~Config_XMLReader();
39 CONFIG_EXPORT void readAll();
42 virtual void processNode(xmlNodePtr aNode);
43 virtual bool processChildren(xmlNodePtr aNode);
45 xmlNodePtr findRoot();
46 void readRecursively(xmlNodePtr theParent);
48 xmlNodePtr node(void* theNode);
49 std::string getProperty(xmlNodePtr theNode, const char* property);
51 * Please note that this function should be called with NULL last argument.
52 * In example: isNode(aNode, "type1", ["type2", ...], NULL);
53 * ", NULL" is required to use unlimited number of arguments.
54 * TODO(sbh): find a way to simplify calling this method.
56 bool isNode(xmlNodePtr theNode, const char* name, ...);
57 bool hasChild(xmlNodePtr theNode);
60 std::string myDocumentPath;
64 #endif /* CONFIG_XMLREADER_H_ */