| API Docs for SAX and DOM |

- Main Page
- Classes
- Files
- Related Pages

# SAXException.hpp

Go to the documentation of this file.

    00001 /*
    00002  * Licensed to the Apache Software Foundation (ASF) under one or more
    00003  * contributor license agreements.  See the NOTICE file distributed with
    00004  * this work for additional information regarding copyright ownership.
    00005  * The ASF licenses this file to You under the Apache License, Version 2.0
    00006  * (the "License"); you may not use this file except in compliance with
    00007  * the License.  You may obtain a copy of the License at
    00008  *
    00009  *      http://www.apache.org/licenses/LICENSE-2.0
    00010  *
    00011  * Unless required by applicable law or agreed to in writing, software
    00012  * distributed under the License is distributed on an "AS IS" BASIS,
    00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00014  * See the License for the specific language governing permissions and
    00015  * limitations under the License.
    00016  */
    00017
    00018 /*
    00019  * $Id: SAXException.hpp 568078 2007-08-21 11:43:25Z amassari $
    00020  */
    00021
    00022
    00023 #ifndef SAXEXCEPTION_HPP
    00024 #define SAXEXCEPTION_HPP
    00025
    00026 #include <xercesc/util/XMLString.hpp>
    00027 #include <xercesc/util/XMLUni.hpp>
    00028 #include <xercesc/util/XMemory.hpp>
    00029
    00030 XERCES_CPP_NAMESPACE_BEGIN
    00031
    00032
    00052 class  SAXException : public XMemory
    00053 {
    00054 public:
    00061     SAXException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) :
    00062
    00063         fMsg(XMLString::replicate(XMLUni::fgZeroLenString, manager))
    00064         , fMemoryManager(manager)
    00065     {
    00066     }
    00067
    00075     SAXException(const XMLCh* const msg,
    00076                  MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) :
    00077
    00078         fMsg(XMLString::replicate(msg, manager))
    00079         , fMemoryManager(manager)
    00080     {
    00081     }
    00082
    00090     SAXException(const char* const msg,
    00091                  MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) :
    00092
    00093         fMsg(XMLString::transcode(msg, manager))
    00094         , fMemoryManager(manager)
    00095     {
    00096     }
    00097
    00103     SAXException(const SAXException& toCopy) :
    00104         XMemory(toCopy)
    00105         , fMsg(XMLString::replicate(toCopy.fMsg, toCopy.fMemoryManager))
    00106         , fMemoryManager(toCopy.fMemoryManager)
    00107     {
    00108     }
    00109
    00111     virtual ~SAXException()
    00112     {
    00113         fMemoryManager->deallocate(fMsg);//delete [] fMsg;
    00114     }
    00115
    00117
    00118
    00126     SAXException& operator=(const SAXException& toCopy)
    00127     {
    00128         if (this == &toCopy)
    00129             return *this;
    00130
    00131         fMemoryManager->deallocate(fMsg);//delete [] fMsg;
    00132         fMsg = XMLString::replicate(toCopy.fMsg, toCopy.fMemoryManager);
    00133         fMemoryManager = toCopy.fMemoryManager;
    00134         return *this;
    00135     }
    00137
    00144     virtual const XMLCh* getMessage() const
    00145     {
    00146         return fMsg;
    00147     }
    00149
    00150
    00151 protected :
    00152     // -----------------------------------------------------------------------
    00153     //  Protected data members
    00154     //
    00155     //  fMsg
    00156     //      This is the text of the error that is being thrown.
    00157     // -----------------------------------------------------------------------
    00158     XMLCh*  fMsg;
    00159     MemoryManager* fMemoryManager;
    00160 };
    00161
    00162 class  SAXNotSupportedException : public SAXException
    00163 {
    00164
    00165 public:
    00166     SAXNotSupportedException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
    00167
    00175     SAXNotSupportedException(const XMLCh* const msg,
    00176                              MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
    00177
    00185     SAXNotSupportedException(const char* const msg,
    00186                              MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
    00187
    00193     SAXNotSupportedException(const SAXException& toCopy);
    00194 };
    00195
    00196 class  SAXNotRecognizedException : public SAXException
    00197 {
    00198 public:
    00199     SAXNotRecognizedException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
    00200
    00208     SAXNotRecognizedException(const XMLCh* const msg,
    00209                               MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
    00210
    00218     SAXNotRecognizedException(const char* const msg,
    00219                               MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
    00220
    00226     SAXNotRecognizedException(const SAXException& toCopy);
    00227 };
    00228
    00229 XERCES_CPP_NAMESPACE_END
    00230
    00231 #endif

Copyright © 1994-2004 The Apache Software Foundation. All Rights Reserved.