Skip to content

Commit

Permalink
support search schemaPath from OpenModelica super project (OpenModeli…
Browse files Browse the repository at this point in the history
  • Loading branch information
arun3688 committed Oct 25, 2023
1 parent ffd0d88 commit 34fe2af
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/OMSimulatorLib/XercesValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,22 @@ oms_status_enu_t oms::XercesValidator::validateSSP(const char *ssd, const std::s
// the shared libraries are put in "install/lib/x86_64-linux-gnu/", so to find the schema location we have to move two directories back
if (!filesystem::exists(schemaSSDPath))
{
// schema path from OMSimulator standalone builds
schemaSSDPath = schemaRootPath / "../../share/OMSimulator/schema/ssp/SystemStructureDescription.xsd";
schemaSSVPath = schemaRootPath / "../../share/OMSimulator/schema/ssp/SystemStructureParameterValues.xsd";
schemaSSMPath = schemaRootPath / "../../share/OMSimulator/schema/ssp/SystemStructureParameterMapping.xsd";
schemaSSCPath = schemaRootPath / "../../share/OMSimulator/schema/ssp/SystemStructureCommon.xsd";
}

// search schema path from top superproject OpenModelica location, shared libs are put in "build/lib/x86_64-linux-gnu/omc/libOMSimulator.so"
if (!filesystem::exists(schemaSSDPath))
{
schemaSSDPath = schemaRootPath / "../../../share/OMSimulator/schema/ssp/SystemStructureDescription.xsd";
schemaSSVPath = schemaRootPath / "../../../share/OMSimulator/schema/ssp/SystemStructureParameterValues.xsd";
schemaSSMPath = schemaRootPath / "../../../share/OMSimulator/schema/ssp/SystemStructureParameterMapping.xsd";
schemaSSCPath = schemaRootPath / "../../../share/OMSimulator/schema/ssp/SystemStructureCommon.xsd";
}

XercesDOMParser domParser;

// load the schema
Expand Down Expand Up @@ -252,9 +262,16 @@ oms_status_enu_t oms::XercesValidator::validateFMU(const char *modeldescription,
// the shared libraries are put in "install/lib/x86_64-linux-gnu/", so to find the schema location we have to move two directories back
if (!filesystem::exists(schemaFmiModeldescriptionPath))
{
// schema path from standalone OMSimulator build
schemaFmiModeldescriptionPath = schemaRootPath / "../../share/OMSimulator/schema/fmi2/fmi2ModelDescription.xsd";
}

// schema path from top superproject OpenModelica location, shared libs are put in "build/lib/x86_64-linux-gnu/omc/libOMSimulator.so"
if (!filesystem::exists(schemaFmiModeldescriptionPath))
{
schemaFmiModeldescriptionPath = schemaRootPath / "../../../share/OMSimulator/schema/fmi2/fmi2ModelDescription.xsd";
}

XercesDOMParser domParser;

// load the schema
Expand Down

0 comments on commit 34fe2af

Please sign in to comment.