structuredocumenthandler.h

00001 /***************************************************************************
00002                           structuredocumenthandler.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 STRUCTUREDOCUMENTHANDLER_H
00020 #define STRUCTUREDOCUMENTHANDLER_H
00021 
00022 #include <xercesc/sax2/DefaultHandler.hpp>
00023 #include <xercesc/sax/SAXParseException.hpp>
00024 #include "structurehandler.h"
00025 #include <sstream>
00026 #include <stack>
00027 
00028 class HandlerContext;
00029 
00030 XERCES_CPP_NAMESPACE_USE;
00031 
00032 using namespace std;
00033 
00045 class StructureDocumentHandler : public DefaultHandler
00046 {
00047 public:
00051   StructureDocumentHandler(StructureHandler* pHandler);
00052 
00054   ~StructureDocumentHandler();
00055 
00065   void startElement(const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname, const Attributes& atts);
00066 
00075   void endElement(const XMLCh* const uri, const XMLCh* const localname,const XMLCh* const qname);
00076 
00084   void characters(const XMLCh* const chars, const unsigned int length);
00085 
00090   void fatalError(const SAXParseException& exc);
00091 
00096   SAXParseException* getParsingException() const { 
00097            if(m_bParsingError)
00098                return m_pException;
00099            else 
00100               return 0;
00101   }
00102 
00107   bool isError() const { return m_bParsingError; }
00108 
00109 protected:
00111   ostringstream m_Buffer;
00112 
00117   int m_iNestedDepth;
00118 
00120   int m_iContextDepth;
00121 
00123   StructureHandler* m_pHandler;
00124 
00129   stack<HandlerContext*> m_ContextStack;
00130 
00134   SAXParseException* m_pException;
00135 
00140   bool m_bParsingError;
00141 
00142 };
00143 
00144 #endif

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