00001 #ifndef Impala_Application_SDash_ActivityHandler_h 00002 #define Impala_Application_SDash_ActivityHandler_h 00003 00004 #include <string> 00005 00006 #include <xercesc/sax/SAXParseException.hpp> 00007 00008 #include "Application/sdash/StrX.h" 00009 #include "Application/sdash/Sax2Handler.h" 00010 00011 namespace Impala { 00012 namespace Application { 00013 namespace SDash { 00014 00015 XERCES_CPP_NAMESPACE_USE 00016 00017 class ActivityHandler : public Sax2Handler 00018 { 00019 00020 public: 00021 00022 ActivityHandler() : mSawActivity(false) 00023 { 00024 } 00025 00026 virtual ~ActivityHandler() 00027 { 00028 } 00029 00030 00031 virtual void startElement(const XMLCh* const uri 00032 , const XMLCh* const localName 00033 , const XMLCh* const qName 00034 , const Attributes& attrs) 00035 { 00036 //int attrsLen = attrs.getLength(); 00037 00038 //StrX uriX(uri); 00039 //const char* uriC = uriX.localForm(); 00040 00041 StrX nameX(localName); 00042 std::string nameC(nameX.localForm()); 00043 00044 //StrX qNameX(qName); 00045 //const char* qNameC = qNameX.localForm(); 00046 00047 if (nameC == "activity") 00048 mSawActivity = true; 00049 } 00050 00051 virtual void characters(const XMLCh* const chars, const unsigned int length) 00052 { 00053 if (mSawActivity) 00054 { 00055 StrX textX(chars); 00056 mActivity = std::string(textX.localForm()); 00057 mSawActivity = false; 00058 } 00059 } 00060 00061 virtual void resetDocument() 00062 { 00063 mSawActivity = false; 00064 } 00065 00066 virtual const std::string& GetActivity() const 00067 { 00068 return mActivity; 00069 } 00070 00071 00072 private: 00073 00074 bool mSawActivity; 00075 std::string mActivity; 00076 00077 }; //class 00078 00079 } 00080 } 00081 } 00082 00083 #endif