Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

DOMTreeErrorReporter.cpp

Go to the documentation of this file.
00001 
00005 /* --------------------------------------------------------------
00006 Copyright (C) 2001 LifeLine Networks BV <soap2corba@lifeline.nl>
00007 
00008 This program is free software; you can redistribute it and/or
00009 modify it under the terms of the GNU General Public License
00010 as published by the Free Software Foundation; either
00011 version 2 of the License, or (at your option) any later
00012 version.
00013 
00014 This program is distributed in the hope that it will be useful,
00015 but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 GNU General Public License for more details.
00018 
00019 You should have received a copy of the GNU General Public License
00020 along with this program; if not, write to the Free Software
00021 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
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 // Construction/Destruction
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     // Ignore all warnings.
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);  // Copy the 'toCatch' object before throwing - 
00085     //   otherwise we would be throwing a reference to
00086     //   a local object that gets destroyed before
00087     //   the catch.
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     // No-op in this case
00110 }
00111 
00112 
00113 

This documentation is part of the "SOAP to CORBA bridge" project
Copyright © 2000 by Lifeline Networks bv.
All rights are reserved.