aboutsummaryrefslogtreecommitdiff
path: root/libxsd/xsd/cxx/xml/dom/bits/error-handler-proxy.txx
diff options
context:
space:
mode:
Diffstat (limited to 'libxsd/xsd/cxx/xml/dom/bits/error-handler-proxy.txx')
-rw-r--r--libxsd/xsd/cxx/xml/dom/bits/error-handler-proxy.txx80
1 files changed, 80 insertions, 0 deletions
diff --git a/libxsd/xsd/cxx/xml/dom/bits/error-handler-proxy.txx b/libxsd/xsd/cxx/xml/dom/bits/error-handler-proxy.txx
new file mode 100644
index 0000000..65a2cf3
--- /dev/null
+++ b/libxsd/xsd/cxx/xml/dom/bits/error-handler-proxy.txx
@@ -0,0 +1,80 @@
+// file : xsd/cxx/xml/dom/bits/error-handler-proxy.txx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include <xsd/cxx/xml/string.hxx>
+
+namespace xsd
+{
+ namespace cxx
+ {
+ namespace xml
+ {
+ namespace dom
+ {
+ namespace bits
+ {
+ template <typename C>
+ bool error_handler_proxy<C>::
+ handleError (const xercesc::DOMError& e)
+ {
+ using xercesc::DOMError;
+
+ if (e.getSeverity() != DOMError::DOM_SEVERITY_WARNING)
+ failed_ = true;
+
+ if (native_eh_)
+ return native_eh_->handleError (e);
+ else
+ {
+ typedef typename error_handler<C>::severity severity;
+
+ severity s (severity::error);
+
+ switch (e.getSeverity())
+ {
+ case DOMError::DOM_SEVERITY_WARNING:
+ {
+ s = severity::warning;
+ break;
+ }
+ case DOMError::DOM_SEVERITY_ERROR:
+ {
+ s = severity::error;
+ break;
+ }
+ case DOMError::DOM_SEVERITY_FATAL_ERROR:
+ {
+ s = severity::fatal;
+ break;
+ }
+ }
+
+ xercesc::DOMLocator* loc (e.getLocation ());
+
+#if _XERCES_VERSION >= 30000
+ return eh_->handle (
+ transcode<C> (loc->getURI ()),
+ static_cast<unsigned long> (loc->getLineNumber ()),
+ static_cast<unsigned long> (loc->getColumnNumber ()),
+ s,
+ transcode<C> (e.getMessage ()));
+#else
+ XMLSSize_t l (loc->getLineNumber ());
+ XMLSSize_t c (loc->getColumnNumber ());
+
+ return eh_->handle (
+ transcode<C> (loc->getURI ()),
+ (l == -1 ? 0 : static_cast<unsigned long> (l)),
+ (c == -1 ? 0 : static_cast<unsigned long> (c)),
+ s,
+ transcode<C> (e.getMessage ()));
+#endif
+ }
+ }
+ }
+ }
+ }
+ }
+}