[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [6142] Refactor to make schema name a function call
From: |
Greg Chicares |
Subject: |
[lmi-commits] [6142] Refactor to make schema name a function call |
Date: |
Wed, 18 Mar 2015 22:58:19 +0000 |
Revision: 6142
http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6142
Author: chicares
Date: 2015-03-18 22:58:19 +0000 (Wed, 18 Mar 2015)
Log Message:
-----------
Refactor to make schema name a function call
Modified Paths:
--------------
lmi/trunk/multiple_cell_document.cpp
lmi/trunk/multiple_cell_document.hpp
lmi/trunk/single_cell_document.cpp
lmi/trunk/single_cell_document.hpp
Modified: lmi/trunk/multiple_cell_document.cpp
===================================================================
--- lmi/trunk/multiple_cell_document.cpp 2015-03-18 21:47:36 UTC (rev
6141)
+++ lmi/trunk/multiple_cell_document.cpp 2015-03-18 22:58:19 UTC (rev
6142)
@@ -416,14 +416,16 @@
//============================================================================
void multiple_cell_document::validate_with_xsd_schema(xml::document const& d)
const
{
- xml::error_messages e;
- if(!xsd_schema().validate(cell_sorter().apply(d), e))
+ std::string const s = xsd_schema_name();
+ xml::schema const schema(xml_lmi::dom_parser(AddDataDir(s)).document());
+ xml::error_messages errors;
+ if(!schema.validate(cell_sorter().apply(d), errors))
{
warning()
<< "Validation with schema '"
- << "multiple_cell_document.xsd" // <-- Soon this will vary.
+ << s
<< "' failed.\n\n"
- << e.print()
+ << errors.print()
<< std::flush
;
}
@@ -442,11 +444,10 @@
}
//============================================================================
-xml::schema const& multiple_cell_document::xsd_schema() const
+std::string multiple_cell_document::xsd_schema_name() const
{
- static std::string const f("multiple_cell_document.xsd");
- static xml::schema const z(xml_lmi::dom_parser(AddDataDir(f)).document());
- return z;
+ static std::string const s("multiple_cell_document.xsd");
+ return s;
}
//============================================================================
Modified: lmi/trunk/multiple_cell_document.hpp
===================================================================
--- lmi/trunk/multiple_cell_document.hpp 2015-03-18 21:47:36 UTC (rev
6141)
+++ lmi/trunk/multiple_cell_document.hpp 2015-03-18 22:58:19 UTC (rev
6142)
@@ -69,7 +69,7 @@
bool data_source_is_external(xml::document const&) const;
void validate_with_xsd_schema(xml::document const&) const;
xslt::stylesheet& cell_sorter() const;
- xml::schema const& xsd_schema() const;
+ std::string xsd_schema_name() const;
// Default parameters for the whole case, stored as a vector for
// parallelism with class_parms_ and cell_parms_. Naturally, this
Modified: lmi/trunk/single_cell_document.cpp
===================================================================
--- lmi/trunk/single_cell_document.cpp 2015-03-18 21:47:36 UTC (rev 6141)
+++ lmi/trunk/single_cell_document.cpp 2015-03-18 22:58:19 UTC (rev 6142)
@@ -156,14 +156,16 @@
//============================================================================
void single_cell_document::validate_with_xsd_schema(xml::document const& d)
const
{
- xml::error_messages e;
- if(!xsd_schema().validate(cell_sorter().apply(d), e))
+ std::string const s = xsd_schema_name();
+ xml::schema const schema(xml_lmi::dom_parser(AddDataDir(s)).document());
+ xml::error_messages errors;
+ if(!schema.validate(cell_sorter().apply(d), errors))
{
warning()
<< "Validation with schema '"
- << "single_cell_document.xsd" // <-- Soon this will vary.
+ << s
<< "' failed.\n\n"
- << e.print()
+ << errors.print()
<< std::flush
;
}
@@ -182,11 +184,10 @@
}
//============================================================================
-xml::schema const& single_cell_document::xsd_schema() const
+std::string single_cell_document::xsd_schema_name() const
{
- static std::string const f("single_cell_document.xsd");
- static xml::schema const z(xml_lmi::dom_parser(AddDataDir(f)).document());
- return z;
+ static std::string const s("single_cell_document.xsd");
+ return s;
}
//============================================================================
Modified: lmi/trunk/single_cell_document.hpp
===================================================================
--- lmi/trunk/single_cell_document.hpp 2015-03-18 21:47:36 UTC (rev 6141)
+++ lmi/trunk/single_cell_document.hpp 2015-03-18 22:58:19 UTC (rev 6142)
@@ -63,7 +63,7 @@
bool data_source_is_external(xml::document const&) const;
void validate_with_xsd_schema(xml::document const&) const;
xslt::stylesheet& cell_sorter() const;
- xml::schema const& xsd_schema() const;
+ std::string xsd_schema_name() const;
Input input_data_;
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [6142] Refactor to make schema name a function call,
Greg Chicares <=