Example that shows how to call an external program for validation.
#include <iostream>
#include <string>
#include <vector>
using namespace std;
LIBSBML_CPP_NAMESPACE_USE
int
main (int argc, char *argv[])
{
if (argc < 3)
{
cout << endl << "Usage: callExternalValidator filename externalValidator [ tempSBMLFile outputFile [ ADDITIONAL-ARGS] ]" << endl << endl;
return 1;
}
string filename = argv[1];
string externalValidator = argv[2];
string tempSBMLFileName = filename + "_temp.xml";
if (argc > 3)
tempSBMLFileName = argv[3];
string outputFile = filename + "_out.xml";
if (argc > 4)
outputFile = argv[4];
vector<string> additionalArgs;
for (int i = 5; i < argc; i++)
additionalArgs.push_back(argv[i]);
additionalArgs.push_back(outputFile);
SBMLExternalValidator validator;
validator.setProgram(externalValidator);
validator.setSBMLFileName(tempSBMLFileName);
validator.setOutputFileName(outputFile);
validator.setArguments(additionalArgs);
document->setApplicableValidators(0);
document->addValidator(&validator);
delete document;
return numErrors;
}
SBMLDocument_t * readSBML(const char *filename)
Reads an SBML document from the given file.
Include all SBML types in a single header file.
Definition: SBMLDocument.h:349
unsigned int checkConsistency()
Performs consistency checking and validation on this SBML document.
Definition: SBMLDocument.cpp:699
void printErrors(std::ostream &stream=std::cerr) const
Prints all the errors or warnings encountered trying to parse, check, or translate this SBML document...
Definition: SBMLDocument.cpp:1186