00001 #ifndef NoXmlTreeReader
00002 #ifndef __CINT__
00003 #include <libxml/xmlreader.h>
00004 #endif
00005
00228 #ifndef StlXmlTree_h
00229 #define StlXmlTree_h
00230 #ifdef __ROOT__
00231 #include "Rtypes.h"
00232 #endif
00233 #include <vector>
00234 #include <map>
00235 #include <string>
00236
00237 namespace stl_xml_tree {
00238 const std::string sep = ">";
00239 enum
00240 {
00241 NO_ERROR,
00242 NO_XML_BASE,
00243 BAD_XML
00244 };
00245 }
00246
00247 class StlXmlTree
00248 {
00249 private:
00250 StlXmlTree* Filter;
00251 #ifndef __CINT__
00252 xmlTextReaderPtr reader;
00253 #endif
00254 std::multimap<std::string,std::string> XmlTree;
00255 char* xmlfilename;
00256 std::multimap<std::string,std::string>::const_iterator OnTheTree;
00257 int Depth;
00258 int PreviousDepth;
00259 int MaxDepthWanted;
00260 std::string XmlTreeNodeName;
00261 std::string NodeName;
00262 std::string IdString;
00263 short MyStatus;
00264
00265 void ProcessNode();
00266 #ifdef DEBUG
00267 void ProcessNodeDebug();
00268 #endif
00269 void ProcessAttribute();
00270 bool SkipBasedOnValue(const std::string key, const std::string value);
00271 void UpdateDepth();
00272
00273
00274 public:
00275 StlXmlTree();
00276 StlXmlTree(const std::string xmlfilename, StlXmlTree* filter=0);
00277 virtual ~StlXmlTree(){;}
00278 void ShowTree();
00279 static std::map<std::string,std::string> ParseAttributeString(const std::string);
00280 static std::string MakeKey(const std::string FullyQualifiedParent, const std::string Child);
00281 static std::string QualifyParent(const std::string Parent, const std::string Attributes);
00282 std::vector<std::string> LookUpValueByKey(const std::string key);
00283 std::vector<std::string> LookUpValueByKey
00284 (std::string& Parent, const std::string ParentAttributes, const std::string Child);
00285
00286 void InsertKeyValuePair(std::string key, std::string value);
00287 static bool AttributesContain(std::string attributeString, std::string attributeName, std::string attributeValue);
00288 inline short GetStatus() {return MyStatus;};
00289 #ifdef __ROOT__
00290 ClassDef(StlXmlTree,0);
00291 #endif
00292 };
00293 #endif
00294 #endif