lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [6140] Improve display of schema diagnostics


From: Greg Chicares
Subject: [lmi-commits] [6140] Improve display of schema diagnostics
Date: Wed, 18 Mar 2015 21:29:24 +0000

Revision: 6140
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6140
Author:   chicares
Date:     2015-03-18 21:29:22 +0000 (Wed, 18 Mar 2015)
Log Message:
-----------
Improve display of schema diagnostics

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/multiple_cell_document.cpp
    lmi/trunk/single_cell_document.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2015-03-18 02:08:46 UTC (rev 6139)
+++ lmi/trunk/ChangeLog 2015-03-18 21:29:22 UTC (rev 6140)
@@ -35863,3 +35863,20 @@
 schemata are used by lmi instead of the otherwise preferable 'rnc'
 equivalents that are regrettably not supported by libxml2.
 
+20150318T0046Z <address@hidden> [516]
+
+  test_schemata.sh
+Test obsolescent schemata added 20150318T0042Z.
+
+20150318T0208Z <address@hidden> [516]
+
+  multiple_cell_document_01.rnc
+  multiple_cell_document_01.xsd
+Refer to a census with the 'data_source' attribute.
+
+20150318T2129Z <address@hidden> [516]
+
+  multiple_cell_document.cpp
+  single_cell_document.cpp
+Improve display of schema diagnostics.
+

Modified: lmi/trunk/multiple_cell_document.cpp
===================================================================
--- lmi/trunk/multiple_cell_document.cpp        2015-03-18 02:08:46 UTC (rev 
6139)
+++ lmi/trunk/multiple_cell_document.cpp        2015-03-18 21:29:22 UTC (rev 
6140)
@@ -417,19 +417,17 @@
 //============================================================================
 void multiple_cell_document::validate_with_xsd_schema(xml::document const& d) 
const
 {
-    try
+    xml::error_messages e;
+    if(!xsd_schema().validate(cell_sorter().apply(d), e))
         {
-        xml::error_messages e;
-        if(!xsd_schema().validate(cell_sorter().apply(d), e))
-            {
-            throw xml::exception(e);
-            }
+        warning()
+            << "Validation with schema '"
+            << "multiple_cell_document.xsd" // <-- Soon this will vary.
+            << "' failed.\n\n"
+            << e.print()
+            << std::flush
+            ;
         }
-    catch(...)
-        {
-        warning() << "Schema validation failed--diagnostics follow." << 
std::flush;
-        report_exception();
-        }
 }
 
 /// Stylesheet to sort <cell> elements.

Modified: lmi/trunk/single_cell_document.cpp
===================================================================
--- lmi/trunk/single_cell_document.cpp  2015-03-18 02:08:46 UTC (rev 6139)
+++ lmi/trunk/single_cell_document.cpp  2015-03-18 21:29:22 UTC (rev 6140)
@@ -157,27 +157,17 @@
 //============================================================================
 void single_cell_document::validate_with_xsd_schema(xml::document const& d) 
const
 {
-    try
+    xml::error_messages e;
+    if(!xsd_schema().validate(cell_sorter().apply(d), e))
         {
-        xml::error_messages e;
-        if(!xsd_schema().validate(cell_sorter().apply(d), e))
-            {
-            throw xml::exception(e);
-            }
+        warning()
+            << "Validation with schema '"
+            << "single_cell_document.xsd" // <-- Soon this will vary.
+            << "' failed.\n\n"
+            << e.print()
+            << std::flush
+            ;
         }
-    catch(...)
-        {
-// Known shortcomings:
-//  - Two separate messageboxes are displayed; one would be better.
-//  - If the diagnostics are too lengthy, then they're truncated
-//    when displayed. The messagebox is not scrollable--see:
-//      http://lists.nongnu.org/archive/html/lmi/2009-05/msg00032.html
-// Rethrowing the exception has the same effect, because it's caught
-// by OnExceptionInMainLoop(), which (like report_exception()) calls
-// safely_show_message().
-        warning() << "Schema validation failed--diagnostics follow." << 
std::flush;
-        report_exception();
-        }
 }
 
 /// Stylesheet to sort <cell> elements.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]