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

SAXPrint_Handler.h

Go to the documentation of this file.
00001 // $Id: SAXPrint_Handler.h,v 1.1.1.1 2003/02/21 18:36:32 chad Exp $
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    SAXPrint_Handler.h
00006  *
00007  *  $Id: SAXPrint_Handler.h,v 1.1.1.1 2003/02/21 18:36:32 chad Exp $
00008  *
00009  *  @author Nanbor Wang <nanbor@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef ACEXML_SAXPRINT_HANDLER_H
00014 #define ACEXML_SAXPRINT_HANDLER_H
00015 
00016 #include "ACEXML/common/DefaultHandler.h"
00017 
00018 /**
00019  * @class ACEXML_SAXPrint_Handler
00020  *
00021  * @brief ACEXML_SAXPrint_Handler is an example SAX event handler.
00022  *
00023  * This SAX event handler try to regenerate the XML document it
00024  * reads with correct indentation.
00025  */
00026 class ACEXML_SAXPrint_Handler : public ACEXML_DefaultHandler
00027 {
00028 public:
00029   /*
00030    * Default constructor.
00031    */
00032   ACEXML_SAXPrint_Handler (const ACEXML_Char* name);
00033 
00034   /*
00035    * Default destructor.
00036    */
00037   virtual ~ACEXML_SAXPrint_Handler (void);
00038 
00039   // Methods inherit from ACEXML_ContentHandler.
00040 
00041   /*
00042    * Receive notification of character data.
00043    */
00044   virtual void characters (const ACEXML_Char *ch,
00045                            int start,
00046                            int length ACEXML_ENV_ARG_DECL)
00047         ACE_THROW_SPEC ((ACEXML_SAXException))
00048     ;
00049 
00050   /*
00051    * Receive notification of the end of a document.
00052    */
00053   virtual void endDocument (ACEXML_ENV_SINGLE_ARG_DECL)
00054         ACE_THROW_SPEC ((ACEXML_SAXException))
00055     ;
00056 
00057   /*
00058    * Receive notification of the end of an element.
00059    */
00060   virtual void endElement (const ACEXML_Char *namespaceURI,
00061                            const ACEXML_Char *localName,
00062                            const ACEXML_Char *qName ACEXML_ENV_ARG_DECL)
00063         ACE_THROW_SPEC ((ACEXML_SAXException))
00064     ;
00065 
00066   /*
00067    * End the scope of a prefix-URI mapping.
00068    */
00069   virtual void endPrefixMapping (const ACEXML_Char *prefix ACEXML_ENV_ARG_DECL)
00070         ACE_THROW_SPEC ((ACEXML_SAXException))
00071     ;
00072 
00073   /*
00074    * Receive notification of ignorable whitespace in element content.
00075    */
00076   virtual void ignorableWhitespace (const ACEXML_Char *ch,
00077                                     int start,
00078                                     int length ACEXML_ENV_ARG_DECL)
00079         ACE_THROW_SPEC ((ACEXML_SAXException))
00080     ;
00081 
00082   /*
00083    * Receive notification of a processing instruction.
00084    */
00085   virtual void processingInstruction (const ACEXML_Char *target,
00086                                       const ACEXML_Char *data ACEXML_ENV_ARG_DECL)
00087         ACE_THROW_SPEC ((ACEXML_SAXException))
00088     ;
00089 
00090   /*
00091    * Receive an object for locating the origin of SAX document events.
00092    */
00093   virtual void setDocumentLocator (ACEXML_Locator *locator) ;
00094 
00095   /*
00096    * Receive notification of a skipped entity.
00097    */
00098   virtual void skippedEntity (const ACEXML_Char *name ACEXML_ENV_ARG_DECL)
00099         ACE_THROW_SPEC ((ACEXML_SAXException))
00100     ;
00101 
00102   /*
00103    * Receive notification of the beginning of a document.
00104    */
00105   virtual void startDocument (ACEXML_ENV_SINGLE_ARG_DECL)
00106         ACE_THROW_SPEC ((ACEXML_SAXException))
00107     ;
00108 
00109   /*
00110    * Receive notification of the beginning of an element.
00111    */
00112   virtual void startElement (const ACEXML_Char *namespaceURI,
00113                              const ACEXML_Char *localName,
00114                              const ACEXML_Char *qName,
00115                              ACEXML_Attributes *atts ACEXML_ENV_ARG_DECL)
00116         ACE_THROW_SPEC ((ACEXML_SAXException))
00117     ;
00118 
00119   /*
00120    * Begin the scope of a prefix-URI Namespace mapping.
00121    */
00122   virtual void startPrefixMapping (const ACEXML_Char *prefix,
00123                                    const ACEXML_Char *uri ACEXML_ENV_ARG_DECL)
00124         ACE_THROW_SPEC ((ACEXML_SAXException))
00125     ;
00126 
00127   // *** Methods inherit from ACEXML_DTDHandler.
00128 
00129   /*
00130    * Receive notification of a notation declaration event.
00131    */
00132   virtual void notationDecl (const ACEXML_Char *name,
00133                              const ACEXML_Char *publicId,
00134                              const ACEXML_Char *systemId ACEXML_ENV_ARG_DECL)
00135         ACE_THROW_SPEC ((ACEXML_SAXException))
00136     ;
00137 
00138   /*
00139    * Receive notification of an unparsed entity declaration event.
00140    */
00141   virtual void unparsedEntityDecl (const ACEXML_Char *name,
00142                                    const ACEXML_Char *publicId,
00143                                    const ACEXML_Char *systemId,
00144                                    const ACEXML_Char *notationName ACEXML_ENV_ARG_DECL)
00145         ACE_THROW_SPEC ((ACEXML_SAXException))
00146     ;
00147 
00148   // Methods inherit from ACEXML_EnitityResolver.
00149 
00150   /*
00151    * Allow the application to resolve external entities.
00152    */
00153   virtual ACEXML_InputSource *resolveEntity (const ACEXML_Char *publicId,
00154                                              const ACEXML_Char *systemId ACEXML_ENV_ARG_DECL)
00155         ACE_THROW_SPEC ((ACEXML_SAXException))
00156     ;
00157 
00158   // Methods inherit from ACEXML_ErrorHandler.
00159 
00160   /*
00161    * Receive notification of a recoverable error.
00162    */
00163   virtual void error (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL)
00164         ACE_THROW_SPEC ((ACEXML_SAXException))
00165     ;
00166 
00167   /*
00168    * Receive notification of a non-recoverable error.
00169    */
00170   virtual void fatalError (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL)
00171         ACE_THROW_SPEC ((ACEXML_SAXException))
00172     ;
00173 
00174   /*
00175    * Receive notification of a warning.
00176    */
00177   virtual void warning (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL)
00178         ACE_THROW_SPEC ((ACEXML_SAXException))
00179     ;
00180 
00181   void inc_indent ();
00182   void dec_indent ();
00183   void print_indent ();
00184 
00185 private:
00186 
00187   size_t indent_;
00188   ACEXML_Char* fileName_;
00189   ACEXML_Locator* locator_;
00190 };
00191 
00192 #if defined (__ACEXML_INLINE__)
00193 # include "SAXPrint_Handler.i"
00194 #endif /* __ACEXML_INLINE__ */
00195 #endif /* ACEXML_SAXPRINT_HANDLER_H */

Generated on Mon Jun 16 13:23:25 2003 for ACEXML by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002