$treeview $search $mathjax $extrastylesheet
otsdaq
v2_03_00
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #ifndef ots_HttpXmlDocument_h 00002 #define ots_HttpXmlDocument_h 00003 00004 #include "otsdaq-core/XmlUtilities/XmlDocument.h" 00005 00006 #include <stdexcept> 00007 #include <vector> 00008 #include <xercesc/dom/DOMElement.hpp> 00009 #include <xercesc/parsers/XercesDOMParser.hpp> 00010 00011 namespace ots 00012 { 00013 class HttpXmlDocument : public XmlDocument 00014 { 00015 public: 00016 HttpXmlDocument(std::string cookieCode = "", std::string displayName = ""); 00017 HttpXmlDocument(const HttpXmlDocument& doc); 00018 HttpXmlDocument& operator=(const HttpXmlDocument& doc); 00019 ~HttpXmlDocument(void); 00020 00021 void setHeader(std::string cookieCode = "", std::string displayName = ""); 00022 00023 xercesc::DOMElement* getRootDataElement() { return dataElement_; } 00024 00025 xercesc::DOMElement* addTextElementToData(const std::string& field, 00026 const std::string& value = ""); 00027 xercesc::DOMElement* addBinaryStringToData(const std::string& field, 00028 const std::string& binary); 00029 00030 void copyDataChildren(HttpXmlDocument& document); 00031 00032 std::string getMatchingValue(const std::string& field, 00033 const unsigned int occurance = 0); 00034 void getAllMatchingValues(const std::string& field, std::vector<std::string>& retVec); 00035 xercesc::DOMElement* getMatchingElement(const std::string& field, 00036 const unsigned int occurance = 0); 00037 xercesc::DOMElement* getMatchingElementInSubtree(xercesc::DOMElement* currEl, 00038 const std::string& field, 00039 const unsigned int occurance = 0); 00040 void getAllMatchingElements(const std::string& field, 00041 std::vector<xercesc::DOMElement*>& retVec); 00042 void outputXmlDocument(std::ostringstream* out, 00043 bool dispStdOut = false, 00044 bool allowWhiteSpace = false); 00045 bool loadXmlDocument(const std::string& filePath); 00046 00047 unsigned int getChildrenCount(xercesc::DOMElement* parent = 0); 00048 00049 void removeDataElement(unsigned int dataChildIndex = 0); // default to first child 00050 00051 private: 00052 void recursiveAddElementToParent(xercesc::DOMElement* child, 00053 xercesc::DOMElement* parent, 00054 bool html = false); 00055 void recursiveFindAllElements(xercesc::DOMElement* currEl, 00056 const std::string& field, 00057 std::vector<std::string>* retVec); 00058 void recursiveFindAllElements(xercesc::DOMElement* currEl, 00059 const std::string& field, 00060 std::vector<xercesc::DOMElement*>* retVec); 00061 00062 void recursiveOutputXmlDocument(xercesc::DOMElement* currEl, 00063 std::ostringstream* out, 00064 bool dispStdOut = false, 00065 std::string tabStr = "", 00066 bool allowWhiteSpace = false); 00067 void recursiveFixTextFields(xercesc::DOMElement* currEl); 00068 std::string recursiveFindElementValue(xercesc::DOMElement* currEl, 00069 const std::string& field, 00070 const unsigned int occurance, 00071 unsigned int& count); 00072 xercesc::DOMElement* recursiveFindElement(xercesc::DOMElement* currEl, 00073 const std::string& field, 00074 const unsigned int occurance, 00075 unsigned int& count); 00076 00077 xercesc::DOMElement* headerElement_; 00078 xercesc::DOMElement* dataElement_; 00079 00080 const std::string headerTagName_; 00081 const std::string dataTagName_; 00082 const std::string cookieCodeTagName_; 00083 const std::string displayNameTagName_; 00084 }; 00085 00086 } // namespace ots 00087 00088 #endif // ots_HttpXmlDocument_h