1 #ifndef ots_HttpXmlDocument_h
2 #define ots_HttpXmlDocument_h
4 #include "otsdaq-core/XmlUtilities/XmlDocument.h"
6 #include <xercesc/parsers/XercesDOMParser.hpp>
7 #include <xercesc/dom/DOMElement.hpp>
23 void setHeader (std::string cookieCode=
"", std::string displayName=
"");
25 xercesc::DOMElement* getRootDataElement () {
return dataElement_; }
27 xercesc::DOMElement* addTextElementToData (
const std::string &field,
const std::string &value =
"");
28 xercesc::DOMElement* addBinaryStringToData (
const std::string &field,
const std::string &binary);
32 std::string getMatchingValue (
const std::string &field,
const unsigned int occurance=0);
33 void getAllMatchingValues (
const std::string &field, std::vector<std::string> &retVec);
34 xercesc::DOMElement* getMatchingElement (
const std::string &field,
const unsigned int occurance=0);
35 xercesc::DOMElement* getMatchingElementInSubtree (xercesc::DOMElement *currEl,
const std::string &field,
const unsigned int occurance = 0);
36 void getAllMatchingElements (
const std::string &field, std::vector< xercesc::DOMElement*> &retVec);
37 void outputXmlDocument (std::ostringstream *out,
bool dispStdOut=
false,
bool allowWhiteSpace=
false);
38 bool loadXmlDocument (
const std::string &filePath);
40 unsigned int getChildrenCount (xercesc::DOMElement* parent = 0);
42 void removeDataElement (
unsigned int dataChildIndex=0);
46 void recursiveAddElementToParent (xercesc::DOMElement* child, xercesc::DOMElement* parent,
bool html=
false);
47 void recursiveFindAllElements (xercesc::DOMElement *currEl,
const std::string &field, std::vector<std::string> *retVec);
48 void recursiveFindAllElements (xercesc::DOMElement *currEl,
const std::string &field, std::vector<xercesc::DOMElement*> *retVec);
50 void recursiveOutputXmlDocument (xercesc::DOMElement *currEl, std::ostringstream *out,
bool dispStdOut=
false, std::string tabStr=
"",
bool allowWhiteSpace=
false);
51 void recursiveFixTextFields (xercesc::DOMElement *currEl);
52 std::string recursiveFindElementValue (xercesc::DOMElement *currEl,
const std::string &field,
const unsigned int occurance,
unsigned int &count);
53 xercesc::DOMElement* recursiveFindElement (xercesc::DOMElement *currEl,
const std::string &field,
const unsigned int occurance,
unsigned int &count);
57 xercesc::DOMElement* headerElement_;
58 xercesc::DOMElement* dataElement_;
60 const std::string headerTagName_;
61 const std::string dataTagName_;
62 const std::string cookieCodeTagName_;
63 const std::string displayNameTagName_;
68 #endif //ots_HttpXmlDocument_h