2003-11-03 17:22:45 +01:00
|
|
|
/*
|
|
|
|
Xerces Error Handler for Prometheus (and the GUI)
|
|
|
|
by Gustav Larsson
|
|
|
|
gee@pyro.nu
|
|
|
|
*/
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// Includes
|
|
|
|
// ---------------------------------------------------------------------------
|
2004-06-03 20:38:14 +02:00
|
|
|
|
|
|
|
#include "precompiled.h"
|
|
|
|
|
2003-11-03 17:22:45 +01:00
|
|
|
#include "XercesErrorHandler.h"
|
|
|
|
#include <iostream>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2004-06-02 17:38:31 +02:00
|
|
|
#include "Prometheus.h"
|
2004-06-03 03:43:33 +02:00
|
|
|
#include "CLogger.h"
|
2003-11-03 17:22:45 +01:00
|
|
|
|
2004-08-15 22:57:31 +02:00
|
|
|
#define LOG_CATEGORY "xml"
|
|
|
|
|
2003-11-05 23:34:38 +01:00
|
|
|
// Use namespace
|
|
|
|
XERCES_CPP_NAMESPACE_USE
|
|
|
|
|
2004-06-09 16:01:09 +02:00
|
|
|
void CXercesErrorHandler::warning(const SAXParseException &toCatch)
|
2003-11-03 17:22:45 +01:00
|
|
|
{
|
2004-06-09 16:01:09 +02:00
|
|
|
CStr systemId=XMLTranscode(toCatch.getSystemId());
|
|
|
|
CStr message=XMLTranscode(toCatch.getMessage());
|
|
|
|
|
2004-08-15 22:57:31 +02:00
|
|
|
LOG(WARNING, LOG_CATEGORY, "XML Parse Warning: %s:%d:%d: %s",
|
2004-06-09 16:01:09 +02:00
|
|
|
systemId.c_str(),
|
|
|
|
toCatch.getLineNumber(),
|
|
|
|
toCatch.getColumnNumber(),
|
|
|
|
message.c_str());
|
2003-11-03 17:22:45 +01:00
|
|
|
}
|
|
|
|
|
2003-11-06 12:54:46 +01:00
|
|
|
void CXercesErrorHandler::error(const SAXParseException& toCatch)
|
2003-11-03 17:22:45 +01:00
|
|
|
{
|
2004-06-09 16:01:09 +02:00
|
|
|
CStr systemId=XMLTranscode(toCatch.getSystemId());
|
|
|
|
CStr message=XMLTranscode(toCatch.getMessage());
|
2003-11-03 17:22:45 +01:00
|
|
|
fSawErrors = true;
|
2003-11-05 23:34:38 +01:00
|
|
|
|
2004-08-15 22:57:31 +02:00
|
|
|
LOG(ERROR, LOG_CATEGORY, "XML Parse Error: %s:%d:%d: %s",
|
2004-06-09 16:01:09 +02:00
|
|
|
systemId.c_str(),
|
2004-06-02 17:38:31 +02:00
|
|
|
toCatch.getLineNumber(),
|
|
|
|
toCatch.getColumnNumber(),
|
2004-06-09 16:01:09 +02:00
|
|
|
message.c_str());
|
2003-11-03 17:22:45 +01:00
|
|
|
}
|
|
|
|
|
2003-11-06 12:54:46 +01:00
|
|
|
void CXercesErrorHandler::fatalError(const SAXParseException& toCatch)
|
2003-11-03 17:22:45 +01:00
|
|
|
{
|
2004-06-09 16:01:09 +02:00
|
|
|
CStr systemId=XMLTranscode(toCatch.getSystemId());
|
|
|
|
CStr message=XMLTranscode(toCatch.getMessage());
|
2003-11-03 17:22:45 +01:00
|
|
|
fSawErrors = true;
|
2003-11-05 23:34:38 +01:00
|
|
|
|
2004-08-15 22:57:31 +02:00
|
|
|
LOG(ERROR, LOG_CATEGORY, "XML Parse Error (Fatal): %s:%d:%d: %s",
|
2004-06-09 16:01:09 +02:00
|
|
|
systemId.c_str(),
|
2004-06-02 17:38:31 +02:00
|
|
|
toCatch.getLineNumber(),
|
|
|
|
toCatch.getColumnNumber(),
|
2004-06-09 16:01:09 +02:00
|
|
|
message.c_str());
|
2003-11-03 17:22:45 +01:00
|
|
|
}
|
|
|
|
|
2003-11-06 12:54:46 +01:00
|
|
|
void CXercesErrorHandler::resetErrors()
|
2003-11-03 17:22:45 +01:00
|
|
|
{
|
|
|
|
fSawErrors = false;
|
|
|
|
}
|