00001 #ifndef CSXMLHelperXalan_H
00002 #define CSXMLHelperXalan_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 <util/XercesDefs.hpp>
00013 #include <sax/ErrorHandler.hpp>
00014 #include <sax/SAXParseException.hpp>
00015
00016 #include <XalanDOM/XalanDOMString.hpp>
00017
00018 class XalanSourceTreeInit;
00019 class XalanSourceTreeDOMSupport;
00020 class XalanSourceTreeParserLiaison;
00021 class XalanNode;
00022 class XPathEvaluator;
00023 class XalanDocument;
00024 class XObjectPtr;
00025
00026 class XObjectPtr;
00027 class XalanDOMString;
00028 class DOMString;
00029
00030 class CSXMLHelper : public ErrorHandler
00031 {
00032 private:
00033 std::string mErrorMessageString;
00034
00035 XalanSourceTreeInit *theSourceTreeInit;
00036 XalanSourceTreeDOMSupport *theDOMSupport;
00037 XalanSourceTreeParserLiaison *theLiaison;
00038 XalanNode *theContextNode;
00039 XPathEvaluator *theEvaluator;
00040 XalanDocument *theDocument;
00041 int mError;
00042 int mInit;
00043 static int mLock;
00044
00045 XObjectPtr getXPathResult(const std::string &xpath);
00046 std::string toAscii(const XObjectPtr &xObjectPtr);
00047 std::string toAscii(const XalanDOMString &xmlString);
00048 std::string toAscii(const XalanDOMString::CharVectorType &charVec);
00049 std::string toAscii(const DOMString &domString);
00050 std::string toAscii(const XMLCh* xmlChars);
00051
00052 public:
00053 CSXMLHelper(const std::string &xmlFilename, const std::string &contextNode);
00054 virtual ~CSXMLHelper();
00055 static const char *CLASS;
00056 virtual std::string getType() {return (std::string) CLASS;}
00057
00058 int getError(void);
00059 std::string getErrorMessage(void);
00060 int getInt(const std::string &xpath);
00061 std::string getString(const std::string &xpath);
00062
00063
00064
00065
00066 void warning(const SAXParseException& toCatch);
00067 void error(const SAXParseException& toCatch);
00068 void fatalError(const SAXParseException& toCatch);
00069 void resetErrors();
00070 };
00071
00072 #endif CSXMLHelperXalan_H