XMLFilterImpl.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    XMLFilterImpl.h
00006  *
00007  *  $Id: XMLFilterImpl.h 78907 2007-07-16 10:22:58Z sowayaa $
00008  *
00009  *  @author Nanbor Wang <nanbor@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 #ifndef ACEXML_XMLFILTERIMPL_H
00013 #define ACEXML_XMLFILTERIMPL_H
00014 #include /**/ "ace/pre.h"
00015 
00016 #include "ACEXML/common/XMLFilter.h"
00017 #include "ACEXML/common/XMLReader.h"
00018 #include "ACEXML/common/Locator.h"
00019 #include "ACEXML/common/ContentHandler.h"
00020 #include "ACEXML/common/DTDHandler.h"
00021 #include "ACEXML/common/EntityResolver.h"
00022 #include "ACEXML/common/ErrorHandler.h"
00023 
00024 /**
00025  * @class ACEXML_XMLFilterImpl XMLFilterImpl.h "ACEXML/common/XMLFilterImpl.h"
00026  *
00027  * @brief ACEXML_XMLFilterImpl
00028  *
00029  * This class is designed to sit between an XMLReader and the client
00030  * application's event handlers. By default, it does nothing but pass
00031  * requests up to the reader and events on to the handlers unmodified, but
00032  * subclasses can override specific methods to modify the event stream or
00033  * the configuration requests as they pass through.
00034  */
00035 class ACEXML_Export ACEXML_XMLFilterImpl
00036   : public ACEXML_XMLFilter,
00037     public ACEXML_ContentHandler,
00038     public ACEXML_DTDHandler,
00039     public ACEXML_EntityResolver,
00040     public ACEXML_ErrorHandler
00041 {
00042 public:
00043   /**
00044    * Default constructor.  Create with no parent.
00045    */
00046   ACEXML_XMLFilterImpl (void);
00047 
00048   /**
00049    * Construct an XML filter with the specified parent.
00050    */
00051   ACEXML_XMLFilterImpl (ACEXML_XMLReader *parent);
00052 
00053   /**
00054    * Destructor.
00055    */
00056   virtual ~ACEXML_XMLFilterImpl (void);
00057 
00058   /*
00059    * Look up the value of a feature.
00060    */
00061   virtual int getFeature (const ACEXML_Char *name ACEXML_ENV_ARG_DECL);
00062 
00063   /*
00064    * Look up the value of a property.
00065    */
00066   virtual void * getProperty (const ACEXML_Char *name ACEXML_ENV_ARG_DECL);
00067 
00068   /*
00069    * Parse an XML document.
00070    */
00071   virtual void parse (ACEXML_InputSource *input ACEXML_ENV_ARG_DECL);
00072 
00073   /*
00074    * Parse an XML document from a system identifier (URI).
00075    */
00076   virtual void parse (const ACEXML_Char *systemId ACEXML_ENV_ARG_DECL)
00077     // @@ throw IOException???
00078         ;
00079 
00080   /*
00081    * Set the state of a feature.
00082    */
00083   virtual void setFeature (const ACEXML_Char *name,
00084                            int boolean_value ACEXML_ENV_ARG_DECL);
00085 
00086   /*
00087    * Set the value of a property.
00088    */
00089   virtual void setProperty (const ACEXML_Char *name,
00090                             void *value ACEXML_ENV_ARG_DECL);
00091 
00092   /*
00093    * Get the parent reader.
00094    */
00095   virtual ACEXML_XMLReader *getParent (void) const;
00096 
00097   /*
00098    * Set the parent reader.
00099    */
00100   virtual void setParent (ACEXML_XMLReader *parent);
00101 
00102   /*
00103    * Get the current DTD event handler.
00104    */
00105   virtual ACEXML_DTDHandler *getDTDHandler (void) const;
00106 
00107   /*
00108    * Get the current content event handler.
00109    */
00110   virtual ACEXML_ContentHandler *getContentHandler (void) const;
00111 
00112   /*
00113    * Get the current entity resolver.
00114    */
00115   virtual ACEXML_EntityResolver *getEntityResolver (void) const;
00116 
00117   /*
00118    * Get the current error event handler.
00119    */
00120   virtual ACEXML_ErrorHandler *getErrorHandler (void) const;
00121 
00122   /*
00123    * Set the DTD event handler.
00124    */
00125   virtual void setDTDHandler (ACEXML_DTDHandler *handler);
00126 
00127   /*
00128    * Set the content event handler.
00129    */
00130   virtual void setContentHandler (ACEXML_ContentHandler *handler);
00131 
00132   /*
00133    * Set the entity resolver.
00134    */
00135   virtual void setEntityResolver (ACEXML_EntityResolver *handler);
00136 
00137   /*
00138    * Set the error event handler.
00139    */
00140   virtual void setErrorHandler (ACEXML_ErrorHandler *handler);
00141 
00142   /*
00143    * Receive notification of character data.
00144    */
00145   virtual void characters (const ACEXML_Char *ch,
00146                            size_t start,
00147                            size_t length
00148                            ACEXML_ENV_ARG_DECL);
00149 
00150   /*
00151    * Receive notification of the end of a document.
00152    */
00153   virtual void endDocument (ACEXML_ENV_SINGLE_ARG_DECL);
00154 
00155   /*
00156    * Receive notification of the end of an element.
00157    */
00158   virtual void endElement (const ACEXML_Char *namespaceURI,
00159                            const ACEXML_Char *localName,
00160                            const ACEXML_Char *qName ACEXML_ENV_ARG_DECL);
00161 
00162   /*
00163    * End the scope of a prefix-URI mapping.
00164    */
00165   virtual void endPrefixMapping (const ACEXML_Char *prefix ACEXML_ENV_ARG_DECL);
00166 
00167   /*
00168    * Receive notification of ignorable whitespace in element content.
00169    */
00170   virtual void ignorableWhitespace (const ACEXML_Char *ch,
00171                                     int start,
00172                                     int length ACEXML_ENV_ARG_DECL);
00173 
00174   /*
00175    * Receive notification of a processing instruction.
00176    */
00177   virtual void processingInstruction (const ACEXML_Char *target,
00178                                       const ACEXML_Char *data ACEXML_ENV_ARG_DECL);
00179 
00180   /*
00181    * Receive an object for locating the origin of SAX document events.
00182    */
00183   virtual void setDocumentLocator (ACEXML_Locator *locator) ;
00184 
00185   /*
00186    * Receive notification of a skipped entity.
00187    */
00188   virtual void skippedEntity (const ACEXML_Char *name ACEXML_ENV_ARG_DECL);
00189 
00190   /*
00191    * Receive notification of the beginning of a document.
00192    */
00193   virtual void startDocument (ACEXML_ENV_SINGLE_ARG_DECL);
00194 
00195   /*
00196    * Receive notification of the beginning of an element.
00197    */
00198   virtual void startElement (const ACEXML_Char *namespaceURI,
00199                              const ACEXML_Char *localName,
00200                              const ACEXML_Char *qName,
00201                              ACEXML_Attributes *atts ACEXML_ENV_ARG_DECL);
00202 
00203   /*
00204    * Begin the scope of a prefix-URI Namespace mapping.
00205    */
00206   virtual void startPrefixMapping (const ACEXML_Char *prefix,
00207                                    const ACEXML_Char *uri ACEXML_ENV_ARG_DECL);
00208 
00209   // *** Methods inherit from ACEXML_DTDHandler.
00210 
00211   /*
00212    * Receive notification of a notation declaration event.
00213    */
00214   virtual void notationDecl (const ACEXML_Char *name,
00215                              const ACEXML_Char *publicId,
00216                              const ACEXML_Char *systemId ACEXML_ENV_ARG_DECL);
00217 
00218   /*
00219    * Receive notification of an unparsed entity declaration event.
00220    */
00221   virtual void unparsedEntityDecl (const ACEXML_Char *name,
00222                                    const ACEXML_Char *publicId,
00223                                    const ACEXML_Char *systemId,
00224                                    const ACEXML_Char *notationName ACEXML_ENV_ARG_DECL);
00225 
00226   // Methods inherit from ACEXML_EnitityResolver.
00227 
00228   /*
00229    * Allow the application to resolve external entities.
00230    */
00231   virtual ACEXML_InputSource *resolveEntity (const ACEXML_Char *publicId,
00232                                              const ACEXML_Char *systemId ACEXML_ENV_ARG_DECL);
00233 
00234   // Methods inherit from ACEXML_ErrorHandler.
00235 
00236   /*
00237    * Receive notification of a recoverable error.
00238    */
00239   virtual void error (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL);
00240 
00241   /*
00242    * Receive notification of a non-recoverable error.
00243    */
00244   virtual void fatalError (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL);
00245 
00246   /*
00247    * Receive notification of a warning.
00248    */
00249   virtual void warning (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL);
00250 protected:
00251   int setupParser (void);
00252   // Set up the event handlers of parent parser to this.
00253   // Returns -1 if no valid parent is set.
00254 
00255 private:
00256   ACEXML_XMLReader *parent_;
00257   ACEXML_Locator *locator_;
00258   ACEXML_EntityResolver *entityResolver_;
00259   ACEXML_DTDHandler *dtdHandler_;
00260   ACEXML_ContentHandler *contentHandler_;
00261   ACEXML_ErrorHandler *errorHandler_;
00262 };
00263 
00264 #if defined (__ACEXML_INLINE__)
00265 # include "ACEXML/common/XMLFilterImpl.inl"
00266 #endif /* __ACEXML_INLINE__ */
00267 
00268 #include /**/ "ace/post.h"
00269 
00270 #endif /* ACEXML_XMLFILTERIMPL_H */

Generated on Sun Jan 27 13:04:15 2008 for ACEXML by doxygen 1.3.6