1 #ifndef ots_HttpXmlDocument_h
2 #define ots_HttpXmlDocument_h
4 #include "otsdaq/XmlUtilities/XmlDocument.h"
8 #include <xercesc/dom/DOMElement.hpp>
9 #include <xercesc/parsers/XercesDOMParser.hpp>
17 HttpXmlDocument (std::string cookieCode =
"", std::string displayName =
"");
22 void setHeader ( std::string cookieCode =
"",
23 std::string displayName =
"" );
24 xercesc::DOMElement * getRootDataElement (
void ) {
return dataElement_; }
25 xercesc::DOMElement * addTextElementToData (
const std::string & field,
26 const std::string & value =
"" );
27 xercesc::DOMElement * addBinaryStringToData (
const std::string & field,
28 const std::string & binary );
30 std::string getMatchingValue (
const std::string & field,
31 const unsigned int occurance = 0 );
32 void getAllMatchingValues (
const std::string & field,
33 std::vector<std::string> & retVec);
34 xercesc::DOMElement * getMatchingElement (
const std::string & field,
35 const unsigned int occurance = 0 );
36 xercesc::DOMElement * getMatchingElementInSubtree ( xercesc::DOMElement * currEl,
37 const std::string & field,
38 const unsigned int occurance = 0 );
39 void getAllMatchingElements (
const std::string & field,
40 std::vector<xercesc::DOMElement*> & retVec );
41 void outputXmlDocument ( std::ostringstream * out,
42 bool dispStdOut =
false,
43 bool allowWhiteSpace =
false);
44 bool loadXmlDocument (
const std::string & filePath );
45 unsigned int getChildrenCount ( xercesc::DOMElement * parent = 0 );
46 void removeDataElement (
unsigned int dataChildIndex = 0 );
49 void recursiveAddElementToParent ( xercesc::DOMElement * child ,
50 xercesc::DOMElement * parent ,
52 void recursiveFindAllElements ( xercesc::DOMElement * currEl ,
53 const std::string & field ,
54 std::vector<std::string> * retVec );
55 void recursiveFindAllElements ( xercesc::DOMElement * currEl ,
56 const std::string & field ,
57 std::vector<xercesc::DOMElement*> * retVec );
58 void recursiveOutputXmlDocument ( xercesc::DOMElement * currEl ,
59 std::ostringstream * out ,
60 bool dispStdOut =
false ,
61 std::string tabStr =
"" ,
62 bool allowWhiteSpace =
false);
63 void recursiveFixTextFields ( xercesc::DOMElement * currEl );
64 std::string recursiveFindElementValue ( xercesc::DOMElement * currEl ,
65 const std::string & field ,
66 const unsigned int occurance ,
67 unsigned int & count );
68 xercesc::DOMElement * recursiveFindElement ( xercesc::DOMElement * currEl ,
69 const std::string & field ,
70 const unsigned int occurance ,
71 unsigned int & count );
73 xercesc::DOMElement * headerElement_ ;
74 xercesc::DOMElement * dataElement_ ;
76 const std::string headerTagName_ ;
77 const std::string dataTagName_ ;
78 const std::string cookieCodeTagName_ ;
79 const std::string displayNameTagName_;
84 #endif // ots_HttpXmlDocument_h