xmlparser.h

00001 /***************************************************************************
00002                           xmlparser.h  -  description
00003                              -------------------
00004     begin                : mar avr 11 2006
00005     copyright            : (C) 2006 by 
00006                    - Sylvain Archenault <sylvain.archenault@laposte.net>
00007                    - Yves Houpert <yves.houpert@insa-rouen.fr>
00008  ***************************************************************************/
00009 
00010 /***************************************************************************
00011  *                                                                         *
00012  *   This program is free software; you can redistribute it and/or modify  *
00013  *   it under the terms of the GNU General Public License as published by  *
00014  *   the Free Software Foundation; either version 2 of the License, or     *
00015  *   (at your option) any later version.                                   *
00016  *                                                                         *
00017  ***************************************************************************/
00018 
00019 #ifndef XMLPARSER_H
00020 #define XMLPARSER_H
00021 
00022 #include <xercesc/sax2/SAX2XMLReader.hpp>
00023 #include <xercesc/sax2/DefaultHandler.hpp>
00024 #include <xercesc/sax/InputSource.hpp>
00025 #include <xml/structurehandler.h>
00026 #include <xml/structuredocumenthandler.h>
00027 #include <xercesc/sax/SAXParseException.hpp>
00028 #include <string>
00029 
00030 XERCES_CPP_NAMESPACE_USE;
00031 
00032 class BaseMessage;
00033 
00039 class XMLParser
00040 {
00041 public:
00043   XMLParser();
00044 
00046   ~XMLParser();
00047 
00049   static void Initialize();
00050 
00053   BaseMessage* parse(const InputSource& xmlMessage) const;
00054 
00057   BaseMessage* parse(const std::string& xmlMessage) const;
00058 
00063   bool getParsingError() const { return static_cast<StructureDocumentHandler*>(m_pDefaultHandler)->isError(); }
00064 
00069   SAXParseException* getParsingException() const
00070   {
00071     return static_cast<StructureDocumentHandler*>(m_pDefaultHandler)->getParsingException();
00072   }
00073 
00074 private: //private
00076   SAX2XMLReader* m_pParser;
00078   StructureHandler* m_pMessageHandler;
00080   DefaultHandler* m_pDefaultHandler;
00081 };
00082 
00083 #endif

Generated on Fri May 19 12:15:54 2006 for Bamboo Ch@t by  doxygen 1.4.6