#include <XmlErrorHandler.h>
Public Member Functions | |
void | error (const SAXParseException &exception) |
Output row, column of parse error and increment counter. | |
void | error (const SAXParseException &exception) |
Output row, column of parse error and increment counter. | |
void | fatalError (const SAXParseException &exception) |
Output row, column of fatal parse error and increment counter. | |
void | fatalError (const SAXParseException &exception) |
Output row, column of fatal parse error and increment counter. | |
int | getErrorCount () const |
int | getErrorCount () const |
int | getFatalCount () const |
int | getFatalCount () const |
int | getWarningCount () const |
int | getWarningCount () const |
void | resetErrors () |
Clear counters. | |
void | resetErrors () |
Clear counters. | |
void | warning (const SAXParseException &exception) |
Keep count of warnings seen. | |
void | warning (const SAXParseException &exception) |
Keep count of warnings seen. | |
XmlErrorHandler (bool throwErrors=false) | |
XmlErrorHandler (bool throwErrors=false) | |
~XmlErrorHandler () | |
~XmlErrorHandler () | |
Private Attributes | |
int | m_nError |
int | m_nFatal |
int | m_nWarning |
bool | m_throwErrors |
|
00041 : m_throwErrors(throwErrors) 00042 {resetErrors();}
|
|
00043 {}
|
|
00041 : m_throwErrors(throwErrors) 00042 {resetErrors();}
|
|
00043 {}
|
|
Output row, column of parse error and increment counter.
|
|
Output row, column of parse error and increment counter.
00017 { 00018 char* charSyst = XMLString::transcode(toCatch.getSystemId()); 00019 std::string systemId(charSyst); 00020 // std::string systemId(Dom::transToChar(toCatch.getSystemId())); 00021 XMLString::release(&charSyst); 00022 char* charMsg = XMLString::transcode(toCatch.getMessage()); 00023 std::string msg(charMsg); 00024 XMLString::release(&charMsg); 00025 00026 std::string line; 00027 facilities::Util::itoa((int)toCatch.getLineNumber(), line); 00028 std::string col; 00029 facilities::Util::itoa((int)toCatch.getColumnNumber(), col); 00030 00031 m_nError++; 00032 00033 std::string errMsg("Error at file \""); 00034 errMsg += systemId + "\", line " + line + ",column " + col; 00035 errMsg += "\n Message: " + msg; 00036 if (m_throwErrors) { 00037 throw ParseException(errMsg); 00038 } else { 00039 std::cerr << errMsg << "\n\n"; 00040 } 00041 }
|
|
Output row, column of fatal parse error and increment counter.
|
|
Output row, column of fatal parse error and increment counter.
00043 { 00044 00045 // getMessage returns type XMLCh* 00046 00047 char* charMsg = XMLString::transcode(toCatch.getMessage()); 00048 std::string msg(charMsg); 00049 XMLString::release(&charMsg); 00050 00051 m_nFatal++; 00052 00053 if (!(toCatch.getSystemId()) ) { 00054 std::string errMsg("Fatal XML parse error: no such file \n Message: "); 00055 errMsg += msg; 00056 if (m_throwErrors) { 00057 throw ParseException(errMsg); 00058 } else { 00059 std::cerr << errMsg << "\n\n"; 00060 } 00061 } 00062 else { 00063 char* charSyst = XMLString::transcode(toCatch.getSystemId()); 00064 std::string systemId(charSyst); 00065 XMLString::release(&charSyst); 00066 00067 std::string line; 00068 facilities::Util::itoa((int)toCatch.getLineNumber(), line); 00069 std::string col; 00070 facilities::Util::itoa((int)toCatch.getColumnNumber(), col); 00071 std::string errMsg("Fatal error at file \""); 00072 errMsg += systemId + "\", line " + line + ",column " + col; 00073 errMsg += "\n Message: " + msg; 00074 00075 if (m_throwErrors) { 00076 throw ParseException(errMsg); 00077 } else { 00078 std::cerr << errMsg << "\n\n"; 00079 } 00080 } 00081 }
|
|
00057 {return m_nError;}
|
|
00057 {return m_nError;}
|
|
00058 {return m_nFatal;}
|
|
00058 {return m_nFatal;}
|
|
00056 {return m_nWarning;}
|
|
00056 {return m_nWarning;}
|
|
Clear counters.
|
|
Clear counters.
00082 { 00083 m_nWarning = m_nError = m_nFatal = 0; 00084 }
|
|
Keep count of warnings seen.
|
|
Keep count of warnings seen.
00013 { 00014 m_nWarning++; 00015 }
|
|
|
|
|
|
|
|
|