2 * libxml++ and this file are copyright (C) 2000 by Ari Johnson,
3 * (C) 2002-2004 by the libxml dev team and
4 * are covered by the GNU Lesser General Public License, which should be
5 * included with libxml++ as the file COPYING.
8 #ifndef __LIBXMLPP_VALIDATOR_H
9 #define __LIBXMLPP_VALIDATOR_H
11 #include <libxml++/nodes/element.h>
12 #include <libxml++/exceptions/validity_error.h>
13 #include <libxml++/exceptions/internal_error.h>
21 /** Base class for XML validators.
23 class LIBXMLPP_API Validator : NonCopyable
27 ~Validator() override;
30 virtual void initialize_valid();
31 virtual void release_underlying();
33 virtual void on_validity_error(const Glib::ustring& message);
34 virtual void on_validity_warning(const Glib::ustring& message);
36 //TODO: When we can break ABI/API, remove handleException() and make
37 // handle_exception() protected virtual.
38 virtual void handleException(const exception& e);
39 virtual void check_for_exception();
40 virtual void check_for_validity_messages();
42 static void callback_validity_error(void* ctx, const char* msg, ...);
43 static void callback_validity_warning(void* ctx, const char* msg, ...);
45 _xmlValidCtxt* valid_;
46 exception* exception_;
47 Glib::ustring validate_error_;
48 Glib::ustring validate_warning_; //Built gradually - used in an exception at the end of parsing.
51 /// To be called in an exception handler.
52 void handle_exception();
57 #endif //__LIBXMLPP_VALIDATOR_H