1 /*
2  * Copyright 2006-2008 The FLWOR 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 #pragma once
17 #ifndef LOADSCHEMAERRORHANDLER_H_
18 #define LOADSCHEMAERRORHANDLER_H_
19 
20 #include "common/common.h"
21 #ifndef ZORBA_NO_XMLSCHEMA
22 
23 #include <xercesc/sax2/DefaultHandler.hpp>
24 #ifdef CYGWIN
25 #undef WIN32
26 #endif
27 
28 
29 
30 namespace zorba
31 {
32   class QueryLoc;
33 
34 class LoadSchemaErrorHandler : public XERCES_CPP_NAMESPACE::DefaultHandler
35 {
36 public:
37   LoadSchemaErrorHandler (const QueryLoc& loc);
38 
39   ~LoadSchemaErrorHandler ();
40 
getSawErrors()41   bool getSawErrors() const
42   {
43     return theSawErrors;
44   }
45 
46   void warning(const XERCES_CPP_NAMESPACE::SAXParseException& exc);
47   void error(const XERCES_CPP_NAMESPACE::SAXParseException& exc);
48   void fatalError(const XERCES_CPP_NAMESPACE::SAXParseException& exc);
49   void resetErrors();
50 
51 private:
52   const QueryLoc& theQueryLoc;
53   bool            theSawErrors;
54 };
55 
56 } // namespace xqp
57 
58 #endif // ifndef ZORBA_NO_XMLSCHEMA
59 #endif /*LOADSCHEMAERRORHANDLER_H_*/
60 /* vim:set et sw=2 ts=2: */
61