00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 #include <xercesc/util/XMLString.hpp>
00035 #include <xercesc/sax/SAXParseException.hpp>
00036 #include "pana_xml_errorreporter.h"
00037 #include "ace/Log_Msg.h"
00038 
00039 
00040 
00041 
00042 class DOMStrX {
00043     public:
00044        DOMStrX(const XMLCh * const toTranscode) { localRef_ = XMLString::transcode(toTranscode); }
00045 
00046        ~DOMStrX() { XMLString::release(&localRef_); }
00047 
00048        char *localRef() { return localRef_; }
00049 
00050     private:
00051        char *localRef_;
00052 };
00053 
00054 void XMLDOMTreeErrorReporter::warning(const SAXParseException& toCatch)
00055 {
00056     DOMStrX strx(toCatch.getMessage());
00057 
00058     ACE_DEBUG((LM_ERROR, "(%P|%t) Warning at line=%d, column=%d, msg=%s\n",
00059                   toCatch.getLineNumber(),
00060                   toCatch.getColumnNumber(),
00061                   strx.localRef()));
00062 }
00063 
00064 void XMLDOMTreeErrorReporter::error(const SAXParseException& toCatch)
00065 {
00066     DOMStrX strx(toCatch.getMessage());
00067 
00068     fSawErrors = true;
00069 
00070     ACE_DEBUG((LM_ERROR, "(%P|%t) Error at line=%d, column=%d, msg=%s\n",
00071                   toCatch.getLineNumber(),
00072                   toCatch.getColumnNumber(),
00073                   strx.localRef()));
00074 }
00075 
00076 void XMLDOMTreeErrorReporter::fatalError(const SAXParseException& toCatch)
00077 {
00078     DOMStrX strx(toCatch.getMessage());
00079 
00080     fSawErrors = true;
00081 
00082     ACE_DEBUG((LM_ERROR, "(%P|%t) Fatal error at line=%d, column=%d, msg=%s\n",
00083                   toCatch.getLineNumber(),
00084                   toCatch.getColumnNumber(),
00085                   strx.localRef()));
00086 }
00087 
00088