00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "Parser.h"
00025
00027 static char *Dom2Str (DOMString &ds)
00028 {
00029 static char buf [1024];
00030 char *del = ds.transcode ();
00031 strncpy (buf, del, 1023);
00032 buf [1023] = 0;
00033 delete del;
00034 return buf;
00035 }
00036
00038 static char *Num2Str (long num)
00039 {
00040 static char buf [80];
00041 sprintf (buf, "%d", num);
00042 return buf;
00043 }
00044
00046
00048
00049 DOMTreeErrorReporter::DOMTreeErrorReporter()
00050 {
00051
00052 }
00053
00054 DOMTreeErrorReporter::~DOMTreeErrorReporter()
00055 {
00056
00057 }
00058
00060 extern ostream& operator<<(ostream& target, const DOMString& s);
00061
00062
00063 void DOMTreeErrorReporter::warning(const SAXParseException&)
00064 {
00065
00066
00067
00068 }
00069
00070 void DOMTreeErrorReporter::error(const SAXParseException& toCatch)
00071 {
00072 CString msg;
00073 DOMString si (toCatch.getSystemId());
00074 DOMString ms (toCatch.getMessage());
00075 msg = "Error at file \"";
00076 msg += Dom2Str (si);
00077 msg += "\", line ";
00078 msg += Num2Str (toCatch.getLineNumber());
00079 msg += ", column ";
00080 msg += Num2Str (toCatch.getColumnNumber());
00081 msg += "\r\n Message: ";
00082 msg += Dom2Str (ms);
00083 cerr << (const char *) msg << endl;
00084 throw SAXParseException(toCatch);
00085
00086
00087
00088 }
00089
00090 void DOMTreeErrorReporter::fatalError(const SAXParseException& toCatch)
00091 {
00092 CString msg;
00093 DOMString si (toCatch.getSystemId());
00094 DOMString ms (toCatch.getMessage());
00095 msg = "Fatal error at file \"";
00096 msg += Dom2Str (si);
00097 msg += "\", line ";
00098 msg += Num2Str (toCatch.getLineNumber());
00099 msg += ", column ";
00100 msg += Num2Str (toCatch.getColumnNumber());
00101 msg += "\r\n Message: ";
00102 msg += Dom2Str (ms);
00103 cerr << (const char *) msg << endl;
00104 throw SAXParseException(toCatch);
00105 }
00106
00107 void DOMTreeErrorReporter::resetErrors()
00108 {
00109
00110 }
00111
00112
00113