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

XMLFilterImpl.cpp

Go to the documentation of this file.
00001 // -*- C++ -*-  $Id: XMLFilterImpl.cpp,v 1.1.1.1 2003/02/21 18:36:32 chad Exp $
00002 
00003 #include "ACEXML/common/XMLFilterImpl.h"
00004 
00005 #if !defined (__ACEXML_INLINE__)
00006 # include "ACEXML/common/XMLFilterImpl.i"
00007 #endif /* __ACEXML_INLINE__ */
00008 
00009 ACEXML_XMLFilterImpl::ACEXML_XMLFilterImpl (void)
00010   :  parent_ (0),
00011      locator_ (0),
00012      entityResolver_ (0),
00013      dtdHandler_ (0),
00014      contentHandler_ (0),
00015      errorHandler_ (0)
00016 {
00017 }
00018 
00019 ACEXML_XMLFilterImpl::ACEXML_XMLFilterImpl (ACEXML_XMLReader *parent)
00020   : parent_ (parent),
00021     locator_ (0),
00022     entityResolver_ (0),
00023     dtdHandler_ (0),
00024     contentHandler_ (0),
00025     errorHandler_ (0)
00026 {
00027 }
00028 
00029 ACEXML_XMLFilterImpl::~ACEXML_XMLFilterImpl (void)
00030 {
00031   // @@ How are all the object lifecycles managed?
00032 }
00033 
00034 void
00035 ACEXML_XMLFilterImpl::parse (ACEXML_InputSource *input ACEXML_ENV_ARG_DECL)
00036       ACE_THROW_SPEC ((ACEXML_SAXException))
00037 {
00038   if (this->setupParser () < 0)
00039     {
00040       ACEXML_THROW (ACEXML_SAXException (ACE_TEXT ("No Parent available")));
00041     }
00042   this->parent_->parse (input ACEXML_ENV_ARG_PARAMETER);
00043   return;
00044 }
00045 
00046 void
00047 ACEXML_XMLFilterImpl::parse (const ACEXML_Char *systemId ACEXML_ENV_ARG_DECL)
00048       ACE_THROW_SPEC ((ACEXML_SAXException))
00049 {
00050   if (this->setupParser () < 0)
00051     {
00052       ACEXML_THROW (ACEXML_SAXException (ACE_TEXT ("No Parent available")));
00053     }
00054 
00055   this->parent_->parse (new ACEXML_InputSource (systemId) ACEXML_ENV_ARG_PARAMETER);
00056   return;
00057 }
00058 
00059 int
00060 ACEXML_XMLFilterImpl::getFeature (const ACEXML_Char *name ACEXML_ENV_ARG_DECL)
00061         ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
00062                          ACEXML_SAXNotSupportedException))
00063 {
00064   if (this->parent_ != 0)
00065     return this->parent_->getFeature (name ACEXML_ENV_ARG_PARAMETER);
00066 
00067   ACEXML_THROW_RETURN (ACEXML_SAXNotRecognizedException (name), 0);
00068 }
00069 
00070 void *
00071 ACEXML_XMLFilterImpl::getProperty (const ACEXML_Char *name ACEXML_ENV_ARG_DECL)
00072   ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
00073                    ACEXML_SAXNotSupportedException))
00074 {
00075   if (this->parent_ != 0)
00076     return this->parent_->getProperty (name ACEXML_ENV_ARG_PARAMETER);
00077 
00078   ACEXML_THROW_RETURN (ACEXML_SAXNotRecognizedException (name), 0);
00079 }
00080 
00081 void
00082 ACEXML_XMLFilterImpl::setFeature (const ACEXML_Char *name,
00083                                   int boolean_value ACEXML_ENV_ARG_DECL)
00084   ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
00085                    ACEXML_SAXNotSupportedException))
00086 {
00087   if (this->parent_ != 0)
00088     {
00089       this->parent_->setFeature (name,
00090                                  boolean_value ACEXML_ENV_ARG_PARAMETER);
00091       return;
00092     }
00093 
00094   ACEXML_THROW (ACEXML_SAXNotRecognizedException (name));
00095 }
00096 
00097 void
00098 ACEXML_XMLFilterImpl::setProperty (const ACEXML_Char *name,
00099                                    void *value ACEXML_ENV_ARG_DECL)
00100   ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException,
00101                    ACEXML_SAXNotSupportedException))
00102 {
00103   if (this->parent_ != 0)
00104     {
00105       this->parent_->setProperty (name,
00106                                   value ACEXML_ENV_ARG_PARAMETER);
00107       return;
00108     }
00109 
00110   ACEXML_THROW (ACEXML_SAXNotRecognizedException (name));
00111 }
00112 
00113 ACEXML_XMLReader *
00114 ACEXML_XMLFilterImpl::getParent (void) const
00115 {
00116   return this->parent_;
00117 }
00118 
00119 void
00120 ACEXML_XMLFilterImpl::setParent (ACEXML_XMLReader *parent)
00121 {
00122   this->parent_ = parent;
00123 }
00124 
00125 void
00126 ACEXML_XMLFilterImpl::characters (const ACEXML_Char *ch,
00127                                   int start,
00128                                   int length ACEXML_ENV_ARG_DECL)
00129       ACE_THROW_SPEC ((ACEXML_SAXException))
00130 {
00131   if (this->contentHandler_ != 0)
00132     this->contentHandler_->characters (ch, start, length ACEXML_ENV_ARG_PARAMETER);
00133 }
00134 
00135 void
00136 ACEXML_XMLFilterImpl::endDocument (ACEXML_ENV_SINGLE_ARG_DECL)
00137       ACE_THROW_SPEC ((ACEXML_SAXException))
00138 {
00139   if (this->contentHandler_ != 0)
00140     this->contentHandler_->endDocument (ACEXML_ENV_SINGLE_ARG_PARAMETER);
00141 }
00142 
00143 void
00144 ACEXML_XMLFilterImpl::endElement (const ACEXML_Char *namespaceURI,
00145                                   const ACEXML_Char *localName,
00146                                   const ACEXML_Char *qName ACEXML_ENV_ARG_DECL)
00147       ACE_THROW_SPEC ((ACEXML_SAXException))
00148 {
00149   if (this->contentHandler_ != 0)
00150     this->contentHandler_->endElement (namespaceURI,
00151                                        localName,
00152                                        qName ACEXML_ENV_ARG_PARAMETER);
00153 }
00154 
00155 void
00156 ACEXML_XMLFilterImpl::endPrefixMapping (const ACEXML_Char *prefix ACEXML_ENV_ARG_DECL)
00157       ACE_THROW_SPEC ((ACEXML_SAXException))
00158 {
00159   if (this->contentHandler_ != 0)
00160     this->contentHandler_->endPrefixMapping (prefix ACEXML_ENV_ARG_PARAMETER);
00161 }
00162 
00163 void
00164 ACEXML_XMLFilterImpl::ignorableWhitespace (const ACEXML_Char *ch,
00165                                            int start,
00166                                            int length ACEXML_ENV_ARG_DECL)
00167       ACE_THROW_SPEC ((ACEXML_SAXException))
00168 {
00169   if (this->contentHandler_ != 0)
00170     this->contentHandler_->ignorableWhitespace (ch,
00171                                                 start,
00172                                                 length ACEXML_ENV_ARG_PARAMETER);
00173 }
00174 
00175 void
00176 ACEXML_XMLFilterImpl::processingInstruction (const ACEXML_Char *target,
00177                                              const ACEXML_Char *data ACEXML_ENV_ARG_DECL)
00178       ACE_THROW_SPEC ((ACEXML_SAXException))
00179 {
00180   if (this->contentHandler_ != 0)
00181     this->contentHandler_->processingInstruction (target,
00182                                                   data ACEXML_ENV_ARG_PARAMETER);
00183 }
00184 
00185 void
00186 ACEXML_XMLFilterImpl::setDocumentLocator (ACEXML_Locator *locator)
00187 {
00188   if (this->contentHandler_ != 0)
00189     this->contentHandler_->setDocumentLocator (locator);
00190 }
00191 
00192 void
00193 ACEXML_XMLFilterImpl::skippedEntity (const ACEXML_Char *name ACEXML_ENV_ARG_DECL)
00194       ACE_THROW_SPEC ((ACEXML_SAXException))
00195 {
00196   if (this->contentHandler_ != 0)
00197     this->contentHandler_->skippedEntity (name ACEXML_ENV_ARG_PARAMETER);
00198 }
00199 
00200 void
00201 ACEXML_XMLFilterImpl::startDocument (ACEXML_ENV_SINGLE_ARG_DECL)
00202       ACE_THROW_SPEC ((ACEXML_SAXException))
00203 {
00204   if (this->contentHandler_ != 0)
00205     this->contentHandler_->startDocument (ACEXML_ENV_SINGLE_ARG_PARAMETER);
00206 }
00207 
00208 void
00209 ACEXML_XMLFilterImpl::startElement (const ACEXML_Char *namespaceURI,
00210                                     const ACEXML_Char *localName,
00211                                     const ACEXML_Char *qName,
00212                                     ACEXML_Attributes *atts ACEXML_ENV_ARG_DECL)
00213       ACE_THROW_SPEC ((ACEXML_SAXException))
00214 {
00215   if (this->contentHandler_ != 0)
00216     this->contentHandler_->startElement (namespaceURI,
00217                                          localName,
00218                                          qName,
00219                                          atts ACEXML_ENV_ARG_PARAMETER);
00220 }
00221 
00222 void
00223 ACEXML_XMLFilterImpl::startPrefixMapping (const ACEXML_Char *prefix,
00224                                           const ACEXML_Char *uri ACEXML_ENV_ARG_DECL)
00225       ACE_THROW_SPEC ((ACEXML_SAXException))
00226 {
00227   if (this->contentHandler_ != 0)
00228     this->contentHandler_->startPrefixMapping (prefix,
00229                                                uri ACEXML_ENV_ARG_PARAMETER);
00230 }
00231 
00232 void
00233 ACEXML_XMLFilterImpl::notationDecl (const ACEXML_Char *name,
00234                                     const ACEXML_Char *publicId,
00235                                     const ACEXML_Char *systemId ACEXML_ENV_ARG_DECL)
00236       ACE_THROW_SPEC ((ACEXML_SAXException))
00237 {
00238   if (this->dtdHandler_ != 0)
00239     this->dtdHandler_->notationDecl (name,
00240                                      publicId,
00241                                      systemId ACEXML_ENV_ARG_PARAMETER);
00242 }
00243 
00244 void
00245 ACEXML_XMLFilterImpl::unparsedEntityDecl (const ACEXML_Char *name,
00246                                           const ACEXML_Char *publicId,
00247                                           const ACEXML_Char *systemId,
00248                                           const ACEXML_Char *notationName ACEXML_ENV_ARG_DECL)
00249       ACE_THROW_SPEC ((ACEXML_SAXException))
00250 {
00251   if (this->dtdHandler_ != 0)
00252     this->dtdHandler_->unparsedEntityDecl (name,
00253                                            publicId,
00254                                            systemId,
00255                                            notationName ACEXML_ENV_ARG_PARAMETER);
00256 }
00257 
00258 ACEXML_InputSource *
00259 ACEXML_XMLFilterImpl::resolveEntity (const ACEXML_Char *publicId,
00260                                      const ACEXML_Char *systemId ACEXML_ENV_ARG_DECL)
00261       ACE_THROW_SPEC ((ACEXML_SAXException))
00262 {
00263   if (this->entityResolver_ != 0)
00264     return this->entityResolver_->resolveEntity (publicId,
00265                                                  systemId ACEXML_ENV_ARG_PARAMETER);
00266   return 0;
00267 }
00268 
00269 void
00270 ACEXML_XMLFilterImpl::error (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL)
00271       ACE_THROW_SPEC ((ACEXML_SAXException))
00272 {
00273   if (this->errorHandler_ != 0)
00274     this->errorHandler_->error (exception ACEXML_ENV_ARG_PARAMETER);
00275 }
00276 
00277 void
00278 ACEXML_XMLFilterImpl::fatalError (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL)
00279       ACE_THROW_SPEC ((ACEXML_SAXException))
00280 {
00281   if (this->errorHandler_ != 0)
00282     this->errorHandler_->fatalError (exception ACEXML_ENV_ARG_PARAMETER);
00283 }
00284 
00285 void
00286 ACEXML_XMLFilterImpl::warning (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL)
00287       ACE_THROW_SPEC ((ACEXML_SAXException))
00288 {
00289   if (this->errorHandler_ != 0)
00290     this->errorHandler_->warning (exception ACEXML_ENV_ARG_PARAMETER);
00291 }
00292 
00293 ACEXML_DTDHandler *
00294 ACEXML_XMLFilterImpl::getDTDHandler (void) const
00295 {
00296   return this->dtdHandler_;
00297 }
00298 
00299 ACEXML_ContentHandler *
00300 ACEXML_XMLFilterImpl::getContentHandler (void) const
00301 {
00302   return this->contentHandler_;
00303 }
00304 
00305 ACEXML_EntityResolver *
00306 ACEXML_XMLFilterImpl::getEntityResolver (void) const
00307 {
00308   return this->entityResolver_;
00309 }
00310 
00311 ACEXML_ErrorHandler *
00312 ACEXML_XMLFilterImpl::getErrorHandler (void) const
00313 {
00314   return this->errorHandler_;
00315 }
00316 
00317 void
00318 ACEXML_XMLFilterImpl::setDTDHandler (ACEXML_DTDHandler *handler)
00319 {
00320   this->dtdHandler_ = handler;
00321 }
00322 
00323 void
00324 ACEXML_XMLFilterImpl::setContentHandler (ACEXML_ContentHandler *handler)
00325 {
00326   this->contentHandler_ = handler;
00327 }
00328 
00329 void
00330 ACEXML_XMLFilterImpl::setEntityResolver (ACEXML_EntityResolver *handler)
00331 {
00332   this->entityResolver_ = handler;
00333 }
00334 
00335 void
00336 ACEXML_XMLFilterImpl::setErrorHandler (ACEXML_ErrorHandler *handler)
00337 {
00338   this->errorHandler_ = handler;
00339 }

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