[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [6143] Refactor, preparing for schema to depend on version
From: |
Greg Chicares |
Subject: |
[lmi-commits] [6143] Refactor, preparing for schema to depend on version |
Date: |
Thu, 19 Mar 2015 14:27:47 +0000 |
Revision: 6143
http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6143
Author: chicares
Date: 2015-03-19 14:27:46 +0000 (Thu, 19 Mar 2015)
Log Message:
-----------
Refactor, preparing for schema to depend on version
Modified Paths:
--------------
lmi/trunk/input_test.cpp
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/input_test.cpp
===================================================================
--- lmi/trunk/input_test.cpp 2015-03-18 22:58:19 UTC (rev 6142)
+++ lmi/trunk/input_test.cpp 2015-03-19 14:27:46 UTC (rev 6143)
@@ -516,14 +516,14 @@
{
static xml::document const cns =
xml_lmi::dom_parser("sample.cns").document();
static multiple_cell_document const mcd;
- mcd.validate_with_xsd_schema(cns);
+ mcd.validate_with_xsd_schema(cns,
mcd.xsd_schema_name(mcd.class_version()));
}
void input_test::mete_ill_xsd()
{
static xml::document const ill =
xml_lmi::dom_parser("sample.ill").document();
static single_cell_document const scd;
- scd.validate_with_xsd_schema(ill);
+ scd.validate_with_xsd_schema(ill,
scd.xsd_schema_name(scd.class_version()));
}
int test_main(int, char*[])
Modified: lmi/trunk/multiple_cell_document.cpp
===================================================================
--- lmi/trunk/multiple_cell_document.cpp 2015-03-18 22:58:19 UTC (rev
6142)
+++ lmi/trunk/multiple_cell_document.cpp 2015-03-19 14:27:46 UTC (rev
6143)
@@ -133,7 +133,8 @@
if(data_source_is_external(parser.document()))
{
- validate_with_xsd_schema(parser.document());
+ int version = 0; // Not yet available.
+ validate_with_xsd_schema(parser.document(), xsd_schema_name(version));
}
// Version 0 should have been handled above.
@@ -414,16 +415,18 @@
}
//============================================================================
-void multiple_cell_document::validate_with_xsd_schema(xml::document const& d)
const
+void multiple_cell_document::validate_with_xsd_schema
+ (xml::document const& xml
+ ,std::string const& xsd
+ ) const
{
- std::string const s = xsd_schema_name();
- xml::schema const schema(xml_lmi::dom_parser(AddDataDir(s)).document());
+ xml::schema const schema(xml_lmi::dom_parser(AddDataDir(xsd)).document());
xml::error_messages errors;
- if(!schema.validate(cell_sorter().apply(d), errors))
+ if(!schema.validate(cell_sorter().apply(xml), errors))
{
warning()
<< "Validation with schema '"
- << s
+ << xsd
<< "' failed.\n\n"
<< errors.print()
<< std::flush
@@ -444,8 +447,9 @@
}
//============================================================================
-std::string multiple_cell_document::xsd_schema_name() const
+std::string multiple_cell_document::xsd_schema_name(int version) const
{
+(void)&version; // Not used yet.
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 22:58:19 UTC (rev
6142)
+++ lmi/trunk/multiple_cell_document.hpp 2015-03-19 14:27:46 UTC (rev
6143)
@@ -67,9 +67,12 @@
std::string const& xml_root_name() const;
bool data_source_is_external(xml::document const&) const;
- void validate_with_xsd_schema(xml::document const&) const;
+ void validate_with_xsd_schema
+ (xml::document const& xml
+ ,std::string const& xsd
+ ) const;
xslt::stylesheet& cell_sorter() const;
- std::string xsd_schema_name() const;
+ std::string xsd_schema_name(int version) 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 22:58:19 UTC (rev 6142)
+++ lmi/trunk/single_cell_document.cpp 2015-03-19 14:27:46 UTC (rev 6143)
@@ -92,7 +92,8 @@
{
if(data_source_is_external(parser.document()))
{
- validate_with_xsd_schema(parser.document());
+ int version = 0; // Not yet available.
+ validate_with_xsd_schema(parser.document(), xsd_schema_name(version));
}
xml::element const& root(parser.root_node(xml_root_name()));
@@ -154,16 +155,18 @@
}
//============================================================================
-void single_cell_document::validate_with_xsd_schema(xml::document const& d)
const
+void single_cell_document::validate_with_xsd_schema
+ (xml::document const& xml
+ ,std::string const& xsd
+ ) const
{
- std::string const s = xsd_schema_name();
- xml::schema const schema(xml_lmi::dom_parser(AddDataDir(s)).document());
+ xml::schema const schema(xml_lmi::dom_parser(AddDataDir(xsd)).document());
xml::error_messages errors;
- if(!schema.validate(cell_sorter().apply(d), errors))
+ if(!schema.validate(cell_sorter().apply(xml), errors))
{
warning()
<< "Validation with schema '"
- << s
+ << xsd
<< "' failed.\n\n"
<< errors.print()
<< std::flush
@@ -184,8 +187,9 @@
}
//============================================================================
-std::string single_cell_document::xsd_schema_name() const
+std::string single_cell_document::xsd_schema_name(int version) const
{
+(void)&version; // Not used yet.
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 22:58:19 UTC (rev 6142)
+++ lmi/trunk/single_cell_document.hpp 2015-03-19 14:27:46 UTC (rev 6143)
@@ -61,9 +61,12 @@
std::string const& xml_root_name() const;
bool data_source_is_external(xml::document const&) const;
- void validate_with_xsd_schema(xml::document const&) const;
+ void validate_with_xsd_schema
+ (xml::document const& xml
+ ,std::string const& xsd
+ ) const;
xslt::stylesheet& cell_sorter() const;
- std::string xsd_schema_name() const;
+ std::string xsd_schema_name(int version) const;
Input input_data_;
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [6143] Refactor, preparing for schema to depend on version,
Greg Chicares <=