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