Logo Search packages:      
Sourcecode: poco version File versions  Download package

XMLFilterImpl.cpp

//
// XMLFilterImpl.cpp
//
// $Id: //poco/1.2/XML/src/XMLFilterImpl.cpp#2 $
//
// Library: XML
// Package: SAX
// Module:  SAXFilters
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
// 
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//


#include "Poco/SAX/XMLFilterImpl.h"
#include "Poco/SAX/SAXException.h"


namespace Poco {
namespace XML {


XMLFilterImpl::XMLFilterImpl():
      _pParent(0),
      _pEntityResolver(0),
      _pDTDHandler(0),
      _pContentHandler(0),
      _pErrorHandler(0)
{
}

      
00055 XMLFilterImpl::XMLFilterImpl(XMLReader* pParent):
      _pParent(pParent),
      _pEntityResolver(0),
      _pDTDHandler(0),
      _pContentHandler(0),
      _pErrorHandler(0)
{
}

      
00065 XMLFilterImpl::~XMLFilterImpl()
{
}


00070 XMLReader* XMLFilterImpl::getParent() const
{
      return _pParent;
}


00076 void XMLFilterImpl::setParent(XMLReader* pParent)
{
      _pParent = pParent;
}


void XMLFilterImpl::setEntityResolver(EntityResolver* pResolver)
{
      _pEntityResolver = pResolver;
}


00088 EntityResolver* XMLFilterImpl::getEntityResolver() const
{
      return _pEntityResolver;
}


00094 void XMLFilterImpl::setDTDHandler(DTDHandler* pDTDHandler)
{
      _pDTDHandler = pDTDHandler;
}


00100 DTDHandler* XMLFilterImpl::getDTDHandler() const
{
      return _pDTDHandler;
}


00106 void XMLFilterImpl::setContentHandler(ContentHandler* pContentHandler)
{
      _pContentHandler = pContentHandler;
}


00112 ContentHandler* XMLFilterImpl::getContentHandler() const
{
      return _pContentHandler;
}


00118 void XMLFilterImpl::setErrorHandler(ErrorHandler* pErrorHandler)
{
      _pErrorHandler = pErrorHandler;
}


00124 ErrorHandler* XMLFilterImpl::getErrorHandler() const
{
      return _pErrorHandler;
}


00130 void XMLFilterImpl::setFeature(const XMLString& featureId, bool state)
{
      if (_pParent)
            _pParent->setFeature(featureId, state);
      else
            throw SAXNotRecognizedException(fromXMLString(featureId));
}


00139 bool XMLFilterImpl::getFeature(const XMLString& featureId) const
{
      if (_pParent)
            return _pParent->getFeature(featureId);
      else
            throw SAXNotRecognizedException(fromXMLString(featureId));
}


00148 void XMLFilterImpl::setProperty(const XMLString& propertyId, const XMLString& value)
{
      if (_pParent)
            _pParent->setProperty(propertyId, value);
      else
            throw SAXNotRecognizedException(fromXMLString(propertyId));
}


00157 void XMLFilterImpl::setProperty(const XMLString& propertyId, void* value)
{
      if (_pParent)
            _pParent->setProperty(propertyId, value);
      else
            throw SAXNotRecognizedException(fromXMLString(propertyId));
}


00166 void* XMLFilterImpl::getProperty(const XMLString& propertyId) const
{
      if (_pParent)
            return _pParent->getProperty(propertyId);
      else
            throw SAXNotRecognizedException(fromXMLString(propertyId));
}


00175 void XMLFilterImpl::parse(InputSource* pSource)
{
      setupParse();
      _pParent->parse(pSource);
}


00182 void XMLFilterImpl::parse(const XMLString& systemId)
{
      setupParse();
      _pParent->parse(systemId);
}


InputSource* XMLFilterImpl::resolveEntity(const XMLString* publicId, const XMLString& systemId)
{
      if (_pEntityResolver)
            return _pEntityResolver->resolveEntity(publicId, systemId);
      else
            return 0;
}


00198 void XMLFilterImpl::releaseInputSource(InputSource* pSource)
{
      if (_pEntityResolver)
            _pEntityResolver->releaseInputSource(pSource);
}


void XMLFilterImpl::notationDecl(const XMLString& name, const XMLString* publicId, const XMLString* systemId)
{
      if (_pDTDHandler)
            _pDTDHandler->notationDecl(name, publicId, systemId);
}


00212 void XMLFilterImpl::unparsedEntityDecl(const XMLString& name, const XMLString* publicId, const XMLString& systemId, const XMLString& notationName)
{
      if (_pDTDHandler)
            _pDTDHandler->unparsedEntityDecl(name, publicId, systemId, notationName);
}


void XMLFilterImpl::setDocumentLocator(const Locator* loc)
{
      if (_pContentHandler)
            _pContentHandler->setDocumentLocator(loc);
}


00226 void XMLFilterImpl::startDocument()
{
      if (_pContentHandler)
            _pContentHandler->startDocument();
}


00233 void XMLFilterImpl::endDocument()
{
      if (_pContentHandler)
            _pContentHandler->endDocument();
}


00240 void XMLFilterImpl::startElement(const XMLString& uri, const XMLString& localName, const XMLString& qname, const Attributes& attrList)
{
      if (_pContentHandler)
            _pContentHandler->startElement(uri, localName, qname, attrList);
}


00247 void XMLFilterImpl::endElement(const XMLString& uri, const XMLString& localName, const XMLString& qname)
{
      if (_pContentHandler)
            _pContentHandler->endElement(uri, localName, qname);
}


00254 void XMLFilterImpl::characters(const XMLChar ch[], int start, int length)
{
      if (_pContentHandler)
            _pContentHandler->characters(ch, start, length);
}


00261 void XMLFilterImpl::ignorableWhitespace(const XMLChar ch[], int start, int length)
{
      if (_pContentHandler)
            _pContentHandler->ignorableWhitespace(ch, start, length);
}


00268 void XMLFilterImpl::processingInstruction(const XMLString& target, const XMLString& data)
{
      if (_pContentHandler)
            _pContentHandler->processingInstruction(target, data);
}


00275 void XMLFilterImpl::startPrefixMapping(const XMLString& prefix, const XMLString& uri)
{
      if (_pContentHandler)
            _pContentHandler->startPrefixMapping(prefix, uri);
}


00282 void XMLFilterImpl::endPrefixMapping(const XMLString& prefix)
{
      if (_pContentHandler)
            _pContentHandler->endPrefixMapping(prefix);
}


00289 void XMLFilterImpl::skippedEntity(const XMLString& prefix)
{
      if (_pContentHandler)
            _pContentHandler->skippedEntity(prefix);
}


void XMLFilterImpl::warning(const SAXException& e)
{
      if (_pErrorHandler)
            _pErrorHandler->warning(e);
}


00303 void XMLFilterImpl::error(const SAXException& e)
{
      if (_pErrorHandler)
            _pErrorHandler->error(e);
}


00310 void XMLFilterImpl::fatalError(const SAXException& e)
{
      if (_pErrorHandler)
            _pErrorHandler->fatalError(e);
}


00317 void XMLFilterImpl::setupParse()
{
      poco_check_ptr (_pParent);

      _pParent->setEntityResolver(this);
      _pParent->setDTDHandler(this);
      _pParent->setContentHandler(this);
      _pParent->setErrorHandler(this);
}


} } // namespace Poco::XML

Generated by  Doxygen 1.6.0   Back to index