20 #ifndef CONFIG_XMLREADER_H_
21 #define CONFIG_XMLREADER_H_
23 #include <Config_def.h>
30 typedef struct _xmlNode xmlNode;
31 typedef xmlNode *xmlNodePtr;
36 typedef struct _xmlDoc xmlDoc;
37 typedef xmlDoc *xmlDocPtr;
54 CONFIG_EXPORT
Config_XMLReader(
const std::string& theXmlFile,
bool isXMLContent =
false);
76 CONFIG_EXPORT xmlNodePtr
findRoot(
const std::string theDocumentPath =
"");
78 CONFIG_EXPORT
const char* encoding()
const;
82 CONFIG_EXPORT
static std::string
83 findConfigFile(
const std::string theFileName,
const int theFindIndex = 0);
96 virtual void cleanup(xmlNodePtr aNode);
111 xmlNodePtr
node(
void* theNode);
116 void storeAttribute(xmlNodePtr theNode,
const char* theNodeAttribute,
bool doClean =
false);
118 std::string
restoreAttribute(xmlNodePtr theNode,
const char* theNodeAttribute);
120 std::string
restoreAttribute(
const char* theNodeName,
const char* theNodeAttribute);
124 bool cleanupAttribute(
const char* theNodeName,
const char* theNodeAttribute);
Base class for all libxml readers. Provides high-level API for all xml operations.
Definition: Config_XMLReader.h:48
xmlNodePtr node(void *theNode)
void* -> xmlNodePtr
Definition: Config_XMLReader.cpp:253
static CONFIG_EXPORT std::string findConfigFile(const std::string theFileName, const int theFindIndex=0)
Checks all possible paths to configuration file given Uses theFindIndex if several solutions can be f...
Definition: Config_XMLReader.cpp:99
CONFIG_EXPORT Config_XMLReader(const std::string &theXmlFile, bool isXMLContent=false)
Definition: Config_XMLReader.cpp:48
std::string myRootFileName
name of the root file
Definition: Config_XMLReader.h:129
virtual void cleanup(xmlNodePtr aNode)
Definition: Config_XMLReader.cpp:200
CONFIG_EXPORT void readAll()
Definition: Config_XMLReader.cpp:161
virtual void processNode(xmlNodePtr aNode)
Allows to customize reader's behavior for a node. Virtual. The default implementation process "source...
Definition: Config_XMLReader.cpp:188
std::string myDocumentPath
Path to the xml document.
Definition: Config_XMLReader.h:127
static CONFIG_EXPORT std::string resourcesConfigFile()
Definition: Config_XMLReader.cpp:66
static CONFIG_EXPORT std::string pluginConfigFile()
Definition: Config_XMLReader.cpp:82
CONFIG_EXPORT xmlNodePtr findRoot(const std::string theDocumentPath="")
Definition: Config_XMLReader.cpp:212
bool cleanupAttribute(xmlNodePtr theNode, const char *theNodeAttribute)
Cleanups attribute from cache.
Definition: Config_XMLReader.cpp:295
std::string restoreAttribute(xmlNodePtr theNode, const char *theNodeAttribute)
Restores an attribute from internal map.
Definition: Config_XMLReader.cpp:279
void readRecursively(xmlNodePtr theParent)
Definition: Config_XMLReader.cpp:234
xmlDocPtr myXmlDoc
Root of the xml document.
Definition: Config_XMLReader.h:128
virtual bool processChildren(xmlNodePtr aNode)
Defines which nodes should be processed recursively. Virtual. The default impl is to read all nodes.
Definition: Config_XMLReader.cpp:206
std::map< std::string, std::string > myCachedAttributes
A map to store all parent's attributes.
Definition: Config_XMLReader.h:132
void storeAttribute(xmlNodePtr theNode, const char *theNodeAttribute, bool doClean=false)
Stores an attribute in internal map for later use.
Definition: Config_XMLReader.cpp:269
std::string getNodeName(xmlNodePtr theNode)
Gets xml node name.
Definition: Config_XMLReader.cpp:259