Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

sax2formatter.hpp

Go to the documentation of this file.
00001 #if !defined(_SAX2FORMATTER_HPP)
00002 #define _SAX2FORMATTER_HPP
00003 //============================================================================= 
00004 //
00005 // XDFLengine library
00006 //
00007 //-----------------------------------------------------------------------------
00008 //  SAX2Formatter.HPP
00009 //----------------------------------------------------------------------------- 
00015 //_____________________________________________________________________________
00016 //
00017 //  Copyright (C) 2003 Guillaume Baurand. All Rights Reserved.
00018 //
00019 //  This file is part of the XDFLengine project.
00020 //
00021 //  The XDFLengine is free software; you can redistribute it and/or modify
00022 //  it under the terms of the GNU General Public License as published by
00023 //  the Free Software Foundation; either version 2 of the License, or
00024 //  (at your option) any later version.
00025 //
00026 //  This program is distributed in the hope that it will be useful,
00027 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00028 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00029 //  GNU General Public License for more details.
00030 //
00031 //  You should have received a copy of the GNU General Public License
00032 //  along with this program; if not, write to the Free Software
00033 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
00034 //  USA.
00035 //
00036 //  For more information, 
00037 //      contact  : guillaume@baurand.net 
00038 //      or visit : http://xdflengine.sourceforge.net
00039 //
00040 //============================================================================= 
00041 
00042 
00043 #   include "config/commonincs.hpp"
00044 
00045 
00046 #   include <xercesc/framework/XMLFormatter.hpp>
00047 #   include <xercesc/sax2/DefaultHandler.hpp>
00048 #   include "flow/xmlstreamconsumer.hpp"
00049 
00050 
00051 
00052 BEGIN_XDFLENGINE_NS
00053 
00054 
00055 
00056 //============================================================================= 
00057 //  CLASS SAX2Formatter
00058 //----------------------------------------------------------------------------- 
00060 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00061 class XDFLENGINE_EXPORT SAX2Formatter : 
00062     public DefaultHandler,public XMLFormatTarget
00063 {
00064 public:
00065     // -----------------------------------------------------------------------
00066     //  Constructors
00067     // -----------------------------------------------------------------------
00068     SAX2Formatter(const   char* const encodingName, const XMLFormatter::UnRepFlags    unRepFlags, const bool                        expandNamespaces, XMLStreamConsumer*                outStreamConsumer);
00069     ~SAX2Formatter();
00070 
00071 
00072     void setConsumer(XMLStreamConsumer* outStreamConsumer);
00073 
00074 
00075     // -----------------------------------------------------------------------
00076     //  Implementations of the format target interface
00077     // -----------------------------------------------------------------------
00078     //void writeChars(const   XMLByte* const  toWrite);
00079     void writeChars(const   XMLByte* const  toWrite, const unsigned int    count, XMLFormatter* const   formatter);
00080 
00081 
00082     // -----------------------------------------------------------------------
00083     //  Implementations of the SAX DocumentHandler interface
00084     // -----------------------------------------------------------------------
00085     void endDocument();
00086     void endElement(const XMLCh* const uri,const XMLCh* const localname,const XMLCh* const qname);
00087     void characters(const XMLCh* const chars, const unsigned int length);
00088     void ignorableWhitespace(const   XMLCh* const    chars, const unsigned int    length);
00089     void processingInstruction(const   XMLCh* const    target, const XMLCh* const    data);
00090     void startDocument();
00091     void startElement(const XMLCh* const uri,const XMLCh* const localname,const XMLCh* const qname,const Attributes& attributes);
00092 
00093 
00094 
00095     // -----------------------------------------------------------------------
00096     //  Implementations of the SAX ErrorHandler interface
00097     // -----------------------------------------------------------------------
00098     /*void warning(const SAXParseException& exception);
00099     void error(const SAXParseException& exception);
00100     void fatalError(const SAXParseException& exception);*/
00101 
00102 
00103 
00104     // -----------------------------------------------------------------------
00105     //  Implementation of the SAX DTDHandler interface
00106     // -----------------------------------------------------------------------
00107     void notationDecl(const XMLCh* const name, const XMLCh* const publicId, const XMLCh* const systemId);
00108     void unparsedEntityDecl(const XMLCh* const name, const XMLCh* const publicId, const XMLCh* const systemId, const XMLCh* const notationName);
00109 
00110 protected :
00111     // -----------------------------------------------------------------------
00112     //  Private data members
00113     //
00114     //  fFormatter
00115     //      This is the formatter object that is used to output the data
00116     //      to the target. It is set up to format to the standard output
00117     //      stream.
00118     // -----------------------------------------------------------------------
00119     XMLFormatter        fFormatter;
00120     bool                fExpandNS ;
00121     XMLStreamConsumer*  pStreamConsumer;
00122 };
00123 
00124 
00125 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00126 //=============================================================================
00127 
00128 END_XDFLENGINE_NS
00129 
00130 #endif
00131 

Generated on Sat Oct 4 13:20:01 2003 for XDFLengine by doxygen1.3-rc2