00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __RTSAXCPPPARSERIF_H_
00026 #define __RTSAXCPPPARSERIF_H_
00027
00028 #include "rtxsrc/rtxErrCodes.h"
00029 #include "rtxsrc/OSRTInputStreamIF.h"
00030 #include "rtxmlsrc/osrtxml.h"
00031 #include "rtxmlsrc/rtSaxDefs.h"
00032
00033
00034 class EXTXMLCLASS OSXMLErrorInfo {
00035 public:
00036 virtual ~OSXMLErrorInfo () {}
00037 virtual void resetErrorInfo () = 0;
00038 virtual void setErrorInfo (int status, const char* file = 0, int line = 0) = 0;
00039 virtual int getErrorInfo (int* status, const char** file, int* line) = 0;
00040 };
00041
00042 class EXTERNXML OSXMLErrorHandler
00043 {
00044 public:
00045 virtual ~OSXMLErrorHandler () {}
00046
00061 virtual void warning() = 0;
00062
00079 virtual void error() = 0;
00080
00095 virtual void fatalError() = 0;
00096
00104 virtual void resetErrors() = 0;
00106 };
00107
00112 class EXTERNXML OSXMLContentHandler
00113 {
00114 public:
00115 virtual ~OSXMLContentHandler() {}
00116
00133 virtual int characters
00134 (
00135 const OSUTF8CHAR* const chars,
00136 unsigned int length
00137 ) = 0;
00138
00151 virtual int endElement
00152 (
00153 const OSUTF8CHAR* const uri,
00154 const OSUTF8CHAR* const localname,
00155 const OSUTF8CHAR* const qname
00156 ) = 0;
00157
00175 virtual int startElement
00176 (
00177 const OSUTF8CHAR* const uri,
00178 const OSUTF8CHAR* const localname,
00179 const OSUTF8CHAR* const qname,
00180 const OSUTF8CHAR* const* attrs
00181 ) = 0;
00182
00184 };
00185
00186 class EXTXMLCLASS OSXMLBase {
00187 protected:
00188 OSXMLBase () {}
00189
00190 virtual ~OSXMLBase () {}
00191 public:
00192 virtual void release () = 0;
00193 };
00194
00195 #define DECLARE_XMLBASEIMP \
00196 public: void release () { delete this; }
00197
00198 class EXTERNXML OSXMLReaderClass : public OSXMLBase
00199 {
00200 public:
00201
00202 virtual int parse () = 0;
00219 virtual int parse (OSRTInputStreamIF& source) = 0;
00220
00227 virtual int parse
00228 (
00229 const char* const pBuffer,
00230 size_t bufSize
00231 ) = 0;
00232
00247 virtual int parse
00248 (
00249 const char* const systemId
00250 ) = 0;
00251 };
00252
00260 class EXTERNXML OSXMLDefaultHandlerIF :
00261 public OSXMLContentHandler, public OSXMLErrorInfo
00262 {
00263 public:
00264 virtual ~OSXMLDefaultHandlerIF () {}
00265 #if 0
00266
00267 virtual int startElement
00268 (const OSUTF8CHAR* const uri,
00269 const OSUTF8CHAR* const localname,
00270 const OSUTF8CHAR* const qname,
00271 const OSUTF8CHAR* const* attrs) = 0;
00272
00273 virtual int characters
00274 (const OSUTF8CHAR* const chars, unsigned int length) = 0;
00275
00276 virtual int endElement
00277 (const OSUTF8CHAR* const uri,
00278 const OSUTF8CHAR* const localname,
00279 const OSUTF8CHAR* const qname) = 0;
00280 #endif
00281 virtual void startDocument() = 0;
00282 virtual void endDocument () = 0;
00283
00284 virtual int finalize () = 0;
00285 } ;
00286
00287 class EXTXMLCLASS OSXMLParserCtxtIF {
00288 public:
00289 virtual ~OSXMLParserCtxtIF () {}
00290 virtual OSRTInputStreamIF* createInputStream () = 0;
00291 virtual OSRTInputStreamIF* createFileInputStream
00292 (const char* const filename) = 0;
00293 virtual OSRTInputStreamIF* createMemoryInputStream
00294 (OSOCTET* pMemBuf, size_t bufSize) = 0;
00295 virtual OSCTXT* getContext () = 0;
00296 virtual const OSUTF8CHAR* parseQName (const OSUTF8CHAR* const qname) = 0;
00297 };
00298
00299 #ifdef __cplusplus
00300 extern "C" {
00301 #endif
00302
00310 OSXMLReaderClass* rtSaxCppCreateXmlReader
00311 (OSXMLParserCtxtIF* pContext, OSXMLDefaultHandlerIF* pSaxHandler);
00312
00318 int rtSaxCppEnableThreadSafety ();
00319
00330 void rtSaxCppLockXmlLibrary ();
00331
00337 void rtSaxCppUnlockXmlLibrary ();
00338
00339 #ifdef __cplusplus
00340 }
00341 #endif
00342
00343 #endif
00344