Main Page | Class Hierarchy | Class List | File List | Class Members | Related Pages

XMLConverter.h

00001 /* Copyright (c) 2001-2003 EU DataGrid. */
00002 /* For license conditions see http://www.eu-datagrid.org/license.html */
00003 
00004 #ifndef RGMA_XMLCONVERTER_H
00005 #define RGMA_XMLCONVERTER_H
00006 
00007 #include "rgma/RGMAException.h"
00008 #include "rgma/UnknownResourceException.h"
00009 #include "rgma/ResultSet.h"
00010 #include "rgma/RGMAWarning.h"
00011 #include "log4cxx/logger.h"
00012 #include "log4cxx/level.h"
00013 #include "log4cxx/helpers/loglog.h"
00014 #include "log4cxx/propertyconfigurator.h"
00015 #include "log4cxx/helpers/exception.h"
00016 #include <stack>
00017 #include <string>
00018 #include <xercesc/dom/deprecated/DOM.hpp>
00019 #include <xercesc/sax/ErrorHandler.hpp>
00020 
00021 using namespace XERCES_CPP_NAMESPACE;
00022 
00023 namespace glite
00024 {
00025     namespace rgma
00026     {
00030         class XMLConverter : public ErrorHandler
00031         {
00032 
00033             public:
00037                 class Helper
00038                 {
00039                     public:
00040                         std::string message;
00041                         bool isRecoverable;
00042                         std::string source;
00043                         std::string type;
00044 
00045                         Helper(std::string type, std::string message,
00046                             bool isRecoverable, std::string source);
00047                         Helper(const Helper& other);
00048                 };
00049 
00053                 XMLConverter() throw (RGMAException);
00054 
00058                 virtual ~XMLConverter();
00059 
00067                 void convertXMLResponse(ResultSet& resultSet,
00068                     const std::string& xml) throw (RGMAException, UnknownResourceException);
00069 
00073                 void warning(const SAXParseException& exception);
00074 
00078                 void error(const SAXParseException& exception);
00079 
00083                 void fatalError(const SAXParseException& exception);
00084 
00085                 void resetErrors();
00086 
00087             private:
00088 
00089                 RGMAException makeRGMAException(const char* severity,
00090                     const char* operation,
00091                     const char *message);
00092 
00093                 RGMAException makeRGMAException(const char* severity,
00094                     const char* operation,
00095                     const SAXParseException& e);
00096 
00097                 RGMAException makeRGMAException(const char* severity,
00098                     const char* operation,
00099                     const XMLException& e);
00100 
00101                 // This has the added methods for setting the meta data and rows
00102                 // or the result set
00103                 class ResultSetImpl:public ResultSet
00104                 {
00105                     public:
00106                         ResultSetImpl();
00107                         void setMetaData(ResultSetMetaData& metaData);
00108                         void setEndOfResults( bool endOfResults);
00109                         void addRow(Tuple tuple);
00110                         void setWarning(RGMAWarning warning);
00111                 };
00112 
00124                 void checkForHtml(const std::string& document) const throw (RGMAException);
00125 
00126                 DOM_Node skipTextNode( DOM_Element& element );
00127 
00133                 DOM_Document DOMParse(const std::string& document) throw (RGMAException);
00134 
00135                 std::string  schemaLocation;
00136 
00137                 log4cxx::LoggerPtr m_logger;
00138         };
00139     }
00140 }
00141 #endif                                            //RGMA_XMLCONVERTER_H

Generated on Thu May 11 19:23:43 2006 for glite-rgma-api-cpp by doxygen 1.3.5