1 | /*
|
---|
2 | * Copyright 2002,2004 The Apache Software Foundation.
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | */
|
---|
16 |
|
---|
17 | /*
|
---|
18 | * $Id: DOMPrintErrorHandler.cpp,v 1.7 2004/09/08 13:55:31 peiyongz Exp $
|
---|
19 | * $Log: DOMPrintErrorHandler.cpp,v $
|
---|
20 | * Revision 1.7 2004/09/08 13:55:31 peiyongz
|
---|
21 | * Apache License Version 2.0
|
---|
22 | *
|
---|
23 | * Revision 1.6 2003/05/30 09:36:35 gareth
|
---|
24 | * Use new macros for iostream.h and std:: issues.
|
---|
25 | *
|
---|
26 | * Revision 1.5 2003/02/05 18:53:22 tng
|
---|
27 | * [Bug 11915] Utility for freeing memory.
|
---|
28 | *
|
---|
29 | * Revision 1.4 2002/12/10 15:36:36 tng
|
---|
30 | * DOMPrint minor update: print error message to XERCES_STD_QUALIFIER cerr.
|
---|
31 | *
|
---|
32 | * Revision 1.3 2002/06/13 14:55:01 peiyongz
|
---|
33 | * Fix to UNIX compilation failure
|
---|
34 | *
|
---|
35 | * Revision 1.2 2002/06/11 19:46:28 peiyongz
|
---|
36 | * Display error message received from the serializer.
|
---|
37 | *
|
---|
38 | * Revision 1.1 2002/05/29 21:19:50 peiyongz
|
---|
39 | * DOM3 DOMWriter/DOMWriterFilter
|
---|
40 | *
|
---|
41 | *
|
---|
42 | */
|
---|
43 |
|
---|
44 | #include <xercesc/util/XMLString.hpp>
|
---|
45 | #include <xercesc/dom/DOMError.hpp>
|
---|
46 | #if defined(XERCES_NEW_IOSTREAMS)
|
---|
47 | #include <iostream>
|
---|
48 | #else
|
---|
49 | #include <iostream.h>
|
---|
50 | #endif
|
---|
51 |
|
---|
52 | #include "DOMPrintErrorHandler.hpp"
|
---|
53 |
|
---|
54 | bool DOMPrintErrorHandler::handleError(const DOMError &domError)
|
---|
55 | {
|
---|
56 | // Display whatever error message passed from the serializer
|
---|
57 | if (domError.getSeverity() == DOMError::DOM_SEVERITY_WARNING)
|
---|
58 | XERCES_STD_QUALIFIER cerr << "\nWarning Message: ";
|
---|
59 | else if (domError.getSeverity() == DOMError::DOM_SEVERITY_ERROR)
|
---|
60 | XERCES_STD_QUALIFIER cerr << "\nError Message: ";
|
---|
61 | else
|
---|
62 | XERCES_STD_QUALIFIER cerr << "\nFatal Message: ";
|
---|
63 |
|
---|
64 | char *msg = XMLString::transcode(domError.getMessage());
|
---|
65 | XERCES_STD_QUALIFIER cerr<< msg <<XERCES_STD_QUALIFIER endl;
|
---|
66 | XMLString::release(&msg);
|
---|
67 |
|
---|
68 | // Instructs the serializer to continue serialization if possible.
|
---|
69 | return true;
|
---|
70 | }
|
---|
71 |
|
---|