Skip to content

Commit

Permalink
Merge pull request #5333 from NREL/5248-SchematronExtension
Browse files Browse the repository at this point in the history
Fix #5248 - Typo in Schematron extension: .sch, not .sct!
  • Loading branch information
jmarrec authored Dec 23, 2024
2 parents b57dba6 + 940a26a commit 0314c3e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/utilities/xml/XMLValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ openstudio::path XMLValidator::schematronToXslt(const openstudio::path& schemaPa

// This replicates what happens when you do:
// from lxml.isoschematron import Schematron;
// s = Schematron(file='schematron.sct', store_xslt=True)
// s = Schematron(file='schematron.sch', store_xslt=True)
// with open('schematron.xslt', 'w') as f:
// f.write(str(s._validator_xslt))

Expand Down Expand Up @@ -170,7 +170,7 @@ XMLValidator::XMLValidator(const openstudio::path& schemaPath) : m_schemaPath(op
} else if (schemaPath.extension() == ".xslt") {
m_validatorType = XMLValidatorType::XSLTSchematron;
logAndStore(Trace, "Treating schema as a XLST StyleSheet that derives from a Schematron.");
} else if ((schemaPath.extension() == ".xml") || (schemaPath.extension() == ".sct")) {
} else if ((schemaPath.extension() == ".xml") || (schemaPath.extension() == ".sch")) {
m_validatorType = XMLValidatorType::Schematron;
logAndStore(Trace, "Treating schema as a Schematron, converting to an XSLT StyleSheet.");
// Let's use a temporary directory for this, so we avoid having two instances trying to write to the same file and we avoid issues where the
Expand Down Expand Up @@ -262,7 +262,7 @@ bool XMLValidator::validate(const openstudio::path& xmlPath) {
LOG_AND_THROW(logMessage);
}

if (xmlPath.extension() == ".xml") {
if (xmlPath.extension() == ".xml" || xmlPath.extension() == ".sch" || xmlPath.extension() == ".xsd") {
auto t_xmlPath = openstudio::filesystem::system_complete(xmlPath);
m_xmlPath = t_xmlPath;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/utilities/xml/XMLValidator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class UTILITIES_API XMLValidator
*
* The schemaPath extension is used to determine the type of validation to perform:
* - `*.xsd` => XSD
* - `*.xml` or `*.sct` => Schematron (convert to XSLT then validate)
* - `*.xml` or `*.sch` => Schematron (convert to XSLT then validate)
* - `*.xslt` => Schematron that is already transformed to an XSLT stylesheet */
explicit XMLValidator(const openstudio::path& schemaPath);
~XMLValidator();
Expand Down

0 comments on commit 0314c3e

Please sign in to comment.