Main | License | Installation | FAQ | Screenshots | Contact | Links | Sf.net | Freshmeat.net | KDE-Apps.org
Requirements | Design | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

XMLErrorHandler Class Reference
[XML C++ Wrappers]

#include <xmlErrorHandler.hpp>


Public Member Functions

 XMLErrorHandler (void)
void warning (const SAXParseException &toCatch)
void error (const SAXParseException &toCatch)
void fatalError (const SAXParseException &toCatch)
void resetErrors ()
bool getErrorOccurred (void) const
const std::string & getErrorMessage (void) const

Protected Member Functions

void triggerError (const std::string &type, const SAXParseException &toCatch)
std::string createMessage (const std::string &type, const SAXParseException &toCatch)

Protected Attributes

bool errorOccurred
std::string message


Detailed Description

Error-handler for Apache XML-library.
Date:
Sun Jan 09 2005
Author:
Jan Wedekind (wedesoft@users.sourceforge.net)

Definition at line 34 of file xmlErrorHandler.hpp.


Constructor & Destructor Documentation

XMLErrorHandler::XMLErrorHandler ( void   ) 

Definition at line 27 of file xmlErrorHandler.cpp.

00027                                     :
00028   errorOccurred(false)
00029 {
00030 }


Member Function Documentation

void XMLErrorHandler::warning ( const SAXParseException &  toCatch  ) 

Definition at line 32 of file xmlErrorHandler.cpp.

References createMessage().

00033 {
00034   // Ignore all warnings.
00035 #ifndef NDEBUG
00036   cerr << createMessage( "Warning", toCatch ) << endl;
00037 #endif
00038 }

void XMLErrorHandler::error ( const SAXParseException &  toCatch  ) 

Definition at line 40 of file xmlErrorHandler.cpp.

References triggerError().

00041 {
00042   triggerError( "Error", toCatch );
00043 }

void XMLErrorHandler::fatalError ( const SAXParseException &  toCatch  ) 

Definition at line 45 of file xmlErrorHandler.cpp.

References triggerError().

00046 {
00047   triggerError( "Fatal error", toCatch );
00048 }

void XMLErrorHandler::resetErrors (  ) 

Definition at line 50 of file xmlErrorHandler.cpp.

References errorOccurred, and message.

00051 {
00052   errorOccurred = false;
00053   message.clear();
00054 }

bool XMLErrorHandler::getErrorOccurred ( void   )  const [inline]

Definition at line 48 of file xmlErrorHandler.hpp.

References errorOccurred.

Referenced by XMLDocument::fromInputSource().

00048 { return errorOccurred; }

const std::string& XMLErrorHandler::getErrorMessage ( void   )  const [inline]

Definition at line 50 of file xmlErrorHandler.hpp.

References message.

Referenced by XMLDocument::fromInputSource().

00050 { return message; }

void XMLErrorHandler::triggerError ( const std::string &  type,
const SAXParseException &  toCatch 
) [protected]

Definition at line 56 of file xmlErrorHandler.cpp.

References createMessage(), errorOccurred, and message.

Referenced by error(), and fatalError().

00058 {
00059   errorOccurred = true;
00060   ostringstream outputStream;
00061   if ( !message.empty() ) outputStream << message << endl;
00062   outputStream << createMessage( type, toCatch );
00063   message = outputStream.str();
00064 }

std::string XMLErrorHandler::createMessage ( const std::string &  type,
const SAXParseException &  toCatch 
) [protected]

Definition at line 66 of file xmlErrorHandler.cpp.

Referenced by triggerError(), and warning().

00068 {
00069   ostringstream outputStream;
00070   outputStream << type << " at file \""
00071                << StrX<char,XMLCh>( toCatch.getSystemId() ).getBuffer()
00072                << "\", line " << toCatch.getLineNumber()
00073                << ", column " << toCatch.getColumnNumber()
00074                << ": "
00075                << StrX<char,XMLCh>( toCatch.getMessage() ).getBuffer();
00076   return outputStream.str();
00077 }


Field Documentation

bool XMLErrorHandler::errorOccurred [protected]

Definition at line 59 of file xmlErrorHandler.hpp.

Referenced by getErrorOccurred(), resetErrors(), and triggerError().

std::string XMLErrorHandler::message [protected]

Definition at line 61 of file xmlErrorHandler.hpp.

Referenced by getErrorMessage(), resetErrors(), and triggerError().


The documentation for this class was generated from the following files:

anymeal 0.30 - recipe management software - Make the most of your food! - © Jan Wedekind Sun Sep 14 16:01:29 2008 - GNU Free Documentation License