1 #ifndef ots_XmlDocument_h
2 #define ots_XmlDocument_h
15 #include <xercesc/dom/DOM.hpp>
16 #include <xercesc/dom/DOMElement.hpp>
17 #include <xercesc/framework/LocalFileFormatTarget.hpp>
18 #include <xercesc/framework/StdOutFormatTarget.hpp>
19 #include <xercesc/parsers/XercesDOMParser.hpp>
20 #include <xercesc/util/OutOfMemoryException.hpp>
21 #include <xercesc/util/PlatformUtils.hpp>
22 #include <xercesc/util/XMLString.hpp>
24 #if defined(XERCES_NEW_IOSTREAMS)
43 xercesc::DOMElement*
addTextElementToParent(
const std::string& childName,
const std::string& childText, xercesc::DOMElement* parent);
44 xercesc::DOMElement*
addTextElementToParent(
const std::string& childName,
const std::string& childText,
const std::string& parentName,
unsigned int parentIndex = 0);
47 bool loadXmlDocument(
const std::string& filePath);
49 void makeDirectoryBinaryTree(
const std::string& name,
const std::string& rootPath,
int indent, xercesc::DOMElement* anchorNode);
50 xercesc::DOMElement* populateBinaryTreeNode(xercesc::DOMElement* anchorNode,
const std::string& name,
int indent,
bool isLeaf);
51 void setAnchors(
const std::string& fSystemPath,
const std::string& fRootPath);
52 void setDocument(xercesc::DOMDocument* doc);
53 void setDarioStyle(
bool darioStyle);
54 void setRootPath(
const std::string& rootPath) { fRootPath_ = rootPath; }
57 void copyDocument(
const xercesc::DOMDocument* toCopy, xercesc::DOMDocument* copy);
58 void recursiveElementCopy(
const xercesc::DOMElement* toCopy, xercesc::DOMElement* copy);
59 void initDocument(
void);
60 void initPlatform(
void);
61 void terminatePlatform(
void);
62 void recursiveOutputXmlDocument(xercesc::DOMElement* currEl, std::ostringstream* out,
bool dispStdOut =
false,
const std::string& tabStr =
"");
64 xercesc::DOMImplementation* theImplementation_;
65 xercesc::DOMDocument* theDocument_;
66 xercesc::DOMElement* rootElement_;
67 const std::string rootTagName_;
69 xercesc::DOMDocument* doc;
70 xercesc::DOMElement* rootElem;
77 std::string fullFPath;
78 std::stringstream ss_;
79 std::map<int, xercesc::DOMElement*> theNodes_;
80 std::map<int, std::string> theNames_;
81 std::vector<std::string> hierarchyPaths_;
82 xercesc::DOMImplementation* impl;
83 xercesc::DOMLSSerializer* pSerializer;
84 xercesc::DOMConfiguration* pDomConfiguration;
87 std::string fSystemPath_;
88 std::string fRootPath_;
89 std::string fFoldersPath_;
90 std::string fFileName_;
91 std::string fThisFolderPath_;
93 std::map<bool, std::string> isALeaf_;
xercesc::DOMElement * addTextElementToParent(const std::string &childName, const std::string &childText, xercesc::DOMElement *parent)
void copyDocument(const xercesc::DOMDocument *toCopy, xercesc::DOMDocument *copy)
void recursiveRemoveChild(xercesc::DOMElement *childEl, xercesc::DOMElement *parentEl)
XmlDocument(const std::string &rootName="ROOT")
void saveXmlDocument(const std::string &filePath)
void outputXmlDocument(std::ostringstream *out, bool dispStdOut=false)
void recursiveOutputXmlDocument(xercesc::DOMElement *currEl, std::ostringstream *out, bool dispStdOut=false, const std::string &tabStr="")