| /****************************************************************************** |
| * Copyright (C) 2002, International Business Machines Corporation and |
| * others. All Rights Reserved. |
| ******************************************************************************/ |
| #include <util/XercesDefs.hpp> |
| #include <sax/ErrorHandler.hpp> |
| #include <iostream.h> |
| |
| class DOMTreeErrorReporter : public ErrorHandler |
| { |
| public: |
| // ----------------------------------------------------------------------- |
| // Constructors and Destructor |
| // ----------------------------------------------------------------------- |
| DOMTreeErrorReporter() : |
| fSawErrors(false) |
| { |
| } |
| |
| ~DOMTreeErrorReporter() |
| { |
| } |
| |
| // ----------------------------------------------------------------------- |
| // Implementation of the error handler interface |
| // ----------------------------------------------------------------------- |
| void warning(const SAXParseException& toCatch); |
| void error(const SAXParseException& toCatch); |
| void fatalError(const SAXParseException& toCatch); |
| void resetErrors(); |
| |
| // ----------------------------------------------------------------------- |
| // Getter methods |
| // ----------------------------------------------------------------------- |
| bool getSawErrors() const; |
| |
| // ----------------------------------------------------------------------- |
| // Private data members |
| // |
| // fSawErrors |
| // This is set if we get any errors, and is queryable via a getter |
| // method. Its used by the main code to suppress output if there are |
| // errors. |
| // ----------------------------------------------------------------------- |
| bool fSawErrors; |
| }; |
| |
| inline bool DOMTreeErrorReporter::getSawErrors() const |
| { |
| return fSawErrors; |
| } |