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