00001 #ifndef CSXMLHelperTinyXPath_H
00002 #define CSXMLHelperTinyXPath_H
00003
00004 #ifdef WIN32
00005 #pragma warning(disable : 4786 )
00006 #endif
00007
00008 #include "CSLog.h"
00009 #include <string>
00010 #include <iostream.h>
00011
00012 #include "tinyxml.h"
00013 #include "tinystr.h"
00014 #include "tinyxpstream.h"
00015
00016 #include "xmlutil.h"
00017 #include "workitem.h"
00018 #include "workstack.h"
00019 #include "xpathappl.h"
00020
00021 class CSXMLHelper
00022 {
00023 private:
00024 std::string mErrorMessageString;
00025 TiXmlDocument *mXMLdoc;
00026 TiXmlElement *mXMLsource;
00027
00028 int mError;
00029
00030 XObjectPtr getXPathResult(const std::string &xpath);
00031 std::string toAscii(const XObjectPtr &xObjectPtr);
00032 std::string toAscii(const XalanDOMString &xmlString);
00033 std::string toAscii(const XalanDOMString::CharVectorType &charVec);
00034 std::string toAscii(const DOMString &domString);
00035 std::string toAscii(const XMLCh* xmlChars);
00036
00037 public:
00038 CSXMLHelper(const std::string &xmlFilename, const std::string &contextNode);
00039 virtual ~CSXMLHelper();
00040 static const char *CLASS;
00041 virtual std::string getType() {return (std::string) CLASS;}
00042
00043 int getError(void);
00044 std::string getErrorMessage(void);
00045 int getInt(const std::string &xpath);
00046 std::string getString(const std::string &xpath);
00047
00048
00049
00050
00051 void warning(const SAXParseException& toCatch);
00052 void error(const SAXParseException& toCatch);
00053 void fatalError(const SAXParseException& toCatch);
00054 void resetErrors();
00055 };
00056
00057 #endif CSXMLHelperTinyXPath_H