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)
42 xercesc::DOMElement* addTextElementToParent(std::string childName, std::string childText, xercesc::DOMElement* parent);
43 xercesc::DOMElement* addTextElementToParent(std::string childName, std::string childText, std::string parentName,
unsigned int parentIndex = 0);
44 void saveXmlDocument(std::string filePath);
45 void recursiveRemoveChild(xercesc::DOMElement* childEl, xercesc::DOMElement* parentEl);
46 bool loadXmlDocument(std::string filePath);
47 void outputXmlDocument(std::ostringstream* out,
bool dispStdOut =
false);
48 void makeDirectoryBinaryTree(std::string name, std::string rootPath,
int indent, xercesc::DOMElement* anchorNode);
49 xercesc::DOMElement* populateBinaryTreeNode(xercesc::DOMElement* anchorNode, std::string name,
int indent,
bool isLeaf);
50 void setAnchors(std::string fSystemPath, std::string fRootPath);
51 void setDocument(xercesc::DOMDocument* doc);
52 void setDarioStyle(
bool darioStyle);
53 void setRootPath(std::string rootPath) { fRootPath_ = rootPath; }
56 void copyDocument(
const xercesc::DOMDocument* toCopy, xercesc::DOMDocument* copy);
57 void recursiveElementCopy(
const xercesc::DOMElement* toCopy, xercesc::DOMElement* copy);
58 void initDocument(
void);
59 void initPlatform(
void);
60 void terminatePlatform(
void);
61 void recursiveOutputXmlDocument(xercesc::DOMElement* currEl, std::ostringstream* out,
bool dispStdOut =
false, std::string tabStr =
"");
62 std::string escapeString(std::string inString,
bool allowWhiteSpace =
false);
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_;
97 #endif // ots_XmlDocument_h