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

XMLFilterImpl.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    XMLFilterImpl.h
00006  *
00007  *  $Id: XMLFilterImpl.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 #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           ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
00063                            ACEXML_SAXNotSupportedException)) ;
00064 
00065   /*
00066    * Look up the value of a property.
00067    */
00068   virtual void * getProperty (const ACEXML_Char *name ACEXML_ENV_ARG_DECL)
00069     ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
00070                      ACEXML_SAXNotSupportedException)) ;
00071 
00072   /*
00073    * Parse an XML document.
00074    */
00075   virtual void parse (ACEXML_InputSource *input ACEXML_ENV_ARG_DECL)
00076     ACE_THROW_SPEC ((ACEXML_SAXException)) ;
00077 
00078   /*
00079    * Parse an XML document from a system identifier (URI).
00080    */
00081   virtual void parse (const ACEXML_Char *systemId ACEXML_ENV_ARG_DECL)
00082     // @@ throw IOException???
00083         ACE_THROW_SPEC ((ACEXML_SAXException)) ;
00084 
00085   /*
00086    * Set the state of a feature.
00087    */
00088   virtual void setFeature (const ACEXML_Char *name,
00089                            int boolean_value ACEXML_ENV_ARG_DECL)
00090     ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
00091                      ACEXML_SAXNotSupportedException)) ;
00092 
00093   /*
00094    * Set the value of a property.
00095    */
00096   virtual void setProperty (const ACEXML_Char *name,
00097                             void *value ACEXML_ENV_ARG_DECL)
00098     ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
00099                      ACEXML_SAXNotSupportedException)) ;
00100 
00101   /*
00102    * Get the parent reader.
00103    */
00104   virtual ACEXML_XMLReader *getParent (void) const;
00105 
00106   /*
00107    * Set the parent reader.
00108    */
00109   virtual void setParent (ACEXML_XMLReader *parent);
00110 
00111   /*
00112    * Get the current DTD event handler.
00113    */
00114   virtual ACEXML_DTDHandler *getDTDHandler (void) const;
00115 
00116   /*
00117    * Get the current content event handler.
00118    */
00119   virtual ACEXML_ContentHandler *getContentHandler (void) const;
00120 
00121   /*
00122    * Get the current entity resolver.
00123    */
00124   virtual ACEXML_EntityResolver *getEntityResolver (void) const;
00125 
00126   /*
00127    * Get the current error event handler.
00128    */
00129   virtual ACEXML_ErrorHandler *getErrorHandler (void) const;
00130 
00131   /*
00132    * Set the DTD event handler.
00133    */
00134   virtual void setDTDHandler (ACEXML_DTDHandler *handler);
00135 
00136   /*
00137    * Set the content event handler.
00138    */
00139   virtual void setContentHandler (ACEXML_ContentHandler *handler);
00140 
00141   /*
00142    * Set the entity resolver.
00143    */
00144   virtual void setEntityResolver (ACEXML_EntityResolver *handler);
00145 
00146   /*
00147    * Set the error event handler.
00148    */
00149   virtual void setErrorHandler (ACEXML_ErrorHandler *handler);
00150 
00151   /*
00152    * Receive notification of character data.
00153    */
00154   virtual void characters (const ACEXML_Char *ch,
00155                            int start,
00156                            int length ACEXML_ENV_ARG_DECL)
00157       ACE_THROW_SPEC ((ACEXML_SAXException)) ;
00158 
00159   /*
00160    * Receive notification of the end of a document.
00161    */
00162   virtual void endDocument (ACEXML_ENV_SINGLE_ARG_DECL)
00163     ACE_THROW_SPEC ((ACEXML_SAXException)) ;
00164 
00165   /*
00166    * Receive notification of the end of an element.
00167    */
00168   virtual void endElement (const ACEXML_Char *namespaceURI,
00169                            const ACEXML_Char *localName,
00170                            const ACEXML_Char *qName ACEXML_ENV_ARG_DECL)
00171     ACE_THROW_SPEC ((ACEXML_SAXException)) ;
00172 
00173   /*
00174    * End the scope of a prefix-URI mapping.
00175    */
00176   virtual void endPrefixMapping (const ACEXML_Char *prefix ACEXML_ENV_ARG_DECL)
00177     ACE_THROW_SPEC ((ACEXML_SAXException)) ;
00178 
00179   /*
00180    * Receive notification of ignorable whitespace in element content.
00181    */
00182   virtual void ignorableWhitespace (const ACEXML_Char *ch,
00183                                     int start,
00184                                     int length ACEXML_ENV_ARG_DECL)
00185          ACE_THROW_SPEC ((ACEXML_SAXException)) ;
00186 
00187   /*
00188    * Receive notification of a processing instruction.
00189    */
00190   virtual void processingInstruction (const ACEXML_Char *target,
00191                                       const ACEXML_Char *data ACEXML_ENV_ARG_DECL)
00192           ACE_THROW_SPEC ((ACEXML_SAXException)) ;
00193 
00194   /*
00195    * Receive an object for locating the origin of SAX document events.
00196    */
00197   virtual void setDocumentLocator (ACEXML_Locator *locator) ;
00198 
00199   /*
00200    * Receive notification of a skipped entity.
00201    */
00202   virtual void skippedEntity (const ACEXML_Char *name ACEXML_ENV_ARG_DECL)
00203          ACE_THROW_SPEC ((ACEXML_SAXException)) ;
00204 
00205   /*
00206    * Receive notification of the beginning of a document.
00207    */
00208   virtual void startDocument (ACEXML_ENV_SINGLE_ARG_DECL)
00209          ACE_THROW_SPEC ((ACEXML_SAXException)) ;
00210 
00211   /*
00212    * Receive notification of the beginning of an element.
00213    */
00214   virtual void startElement (const ACEXML_Char *namespaceURI,
00215                              const ACEXML_Char *localName,
00216                              const ACEXML_Char *qName,
00217                              ACEXML_Attributes *atts ACEXML_ENV_ARG_DECL)
00218          ACE_THROW_SPEC ((ACEXML_SAXException)) ;
00219 
00220   /*
00221    * Begin the scope of a prefix-URI Namespace mapping.
00222    */
00223   virtual void startPrefixMapping (const ACEXML_Char *prefix,
00224                                    const ACEXML_Char *uri ACEXML_ENV_ARG_DECL)
00225             ACE_THROW_SPEC ((ACEXML_SAXException)) ;
00226 
00227   // *** Methods inherit from ACEXML_DTDHandler.
00228 
00229   /*
00230    * Receive notification of a notation declaration event.
00231    */
00232   virtual void notationDecl (const ACEXML_Char *name,
00233                              const ACEXML_Char *publicId,
00234                              const ACEXML_Char *systemId ACEXML_ENV_ARG_DECL)
00235             ACE_THROW_SPEC ((ACEXML_SAXException)) ;
00236 
00237   /*
00238    * Receive notification of an unparsed entity declaration event.
00239    */
00240   virtual void unparsedEntityDecl (const ACEXML_Char *name,
00241                                    const ACEXML_Char *publicId,
00242                                    const ACEXML_Char *systemId,
00243                                    const ACEXML_Char *notationName ACEXML_ENV_ARG_DECL)
00244             ACE_THROW_SPEC ((ACEXML_SAXException)) ;
00245 
00246   // Methods inherit from ACEXML_EnitityResolver.
00247 
00248   /*
00249    * Allow the application to resolve external entities.
00250    */
00251   virtual ACEXML_InputSource *resolveEntity (const ACEXML_Char *publicId,
00252                                              const ACEXML_Char *systemId ACEXML_ENV_ARG_DECL)
00253             ACE_THROW_SPEC ((ACEXML_SAXException)) ;
00254 
00255   // Methods inherit from ACEXML_ErrorHandler.
00256 
00257   /*
00258    * Receive notification of a recoverable error.
00259    */
00260   virtual void error (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL)
00261         ACE_THROW_SPEC ((ACEXML_SAXException));
00262 
00263   /*
00264    * Receive notification of a non-recoverable error.
00265    */
00266   virtual void fatalError (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL)
00267         ACE_THROW_SPEC ((ACEXML_SAXException));
00268 
00269   /*
00270    * Receive notification of a warning.
00271    */
00272   virtual void warning (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL)
00273     ACE_THROW_SPEC ((ACEXML_SAXException));
00274 protected:
00275   int setupParser (void);
00276   // Set up the event handlers of parent parser to this.
00277   // Returns -1 if no valid parent is set.
00278 
00279 private:
00280   ACEXML_XMLReader *parent_;
00281   ACEXML_Locator *locator_;
00282   ACEXML_EntityResolver *entityResolver_;
00283   ACEXML_DTDHandler *dtdHandler_;
00284   ACEXML_ContentHandler *contentHandler_;
00285   ACEXML_ErrorHandler *errorHandler_;
00286 };
00287 
00288 #if defined (__ACEXML_INLINE__)
00289 # include "ACEXML/common/XMLFilterImpl.i"
00290 #endif /* __ACEXML_INLINE__ */
00291 
00292 #include "ace/post.h"
00293 
00294 #endif /* ACEXML_XMLFILTERIMPL_H */

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