Example program for reading and manipulating the quantitation.xml file.
#include "msparser.hpp"
#include <iostream>
using namespace matrix_science;
int main(int argc, char * argv[])
{
if ( argc < 3 )
{
std::cout << "The location of quantitation.xml file has to be specified as a parameter" << std::endl;
std::cout << "The location should either be the full path to the file" << std::endl;
std::cout << "or a URL to a Mascot server - e.g. http://mascot-server/mascot/cgi" << std::endl;
std::cout << "The second parameter should specify schema file path, for instance C:\\quantitation_1.xsd" << std::endl;
std::cout << "It should be either relative to the local quantitation.xml path or to the current folder" << std::endl;
return 1;
}
if (argc > 3)
{
}
{
std::cout << "There are errors. Cannot continue. The last error description:" << std::endl;
return 1;
}
std::cout << "There are " << n << " methods available:" << std::endl;
int i = 0;
for(i=0; i < n; i++)
{
}
ms_xml_schema schemaFile;
schemaFile.setFileName(argv[2]);
schemaFile.read_file();
if (!schemaFile.isValid())
{
std::cout << "Errors while reading schema-file. The last error description:" << std::endl;
std::cout << schemaFile.getLastErrorString() << std::endl;
return 1;
}
if ( !strValidationErrors.empty() )
{
printf("Initial document validation errors: %s\n", strValidationErrors.c_str());
}
for(i = 0; i < n; i++)
{
if ( !strErrors.empty() )
{
printf(
"Method %s\n", pMethod->
getName().c_str());
printf("Shallow validation errors: %s\n\n", strErrors.c_str());
}
if ( !strErrors.empty() )
{
printf(
"Method %s\n", pMethod->
getName().c_str());
printf("Deep validation errors: %s\n\n", strErrors.c_str());
}
}
printf("shallow validation of a method: %s\n", strErr1.c_str());
std::string strErr2 = myMethodInvalid.
validateDeep(&schemaFile);
printf("deep validation of a method: %s\n", strErr2.c_str());
std::string strErr3 = schemaFile.validateComplexObject(&myMethodInvalid, true);
printf("deep validation using schema-object: %s\n", strErr3.c_str());
std::string strErr4 = schemaFile.validateSimpleString(myMethodInvalid.
getName().c_str(),
printf("attribute validation: %s\n", strErr4.c_str());
printf("document validation errors: %s\n", errMethod.c_str());
{
std::cout << "Errors in config-file object. The last error description:" << std::endl;
}
configFileInvalid.
setFileName(
"quantitation_temp.xml");
{
std::cout << "Errors in config-file object. The last error description:" << std::endl;
}
return 0;
}
Settings required to make an HTTP connection to a Mascot server.
Definition: ms_connection_settings.hpp:54
void setSessionID(const std::string sessionID)
Sets the Mascot security sessionID to be used for the connection.
Definition: ms_connection_settings.cpp:242
std::string getLastErrorString() const
Return the error description of the last error that occurred.
Definition: ms_errors.cpp:1488
bool isValid() const
Call this function to determine if there have been any errors.
Definition: ms_errors.cpp:1472
Use this class in order to read/write quantitation.xml.
Definition: ms_quant_configfile.hpp:52
int getNumberOfMethods() const
Returns a number of quantitation methods currently held in memory.
Definition: ms_quant_configfile.cpp:294
void save_file()
Stores modification information in the file.
Definition: ms_quant_configfile.cpp:245
std::string validateDocument() const
Validates the whole document against the schema and return errors as a string.
Definition: ms_quant_configfile.cpp:286
void appendMethod(const ms_quant_method *item)
Adds a new quantitation method at the end of the list.
Definition: ms_quant_configfile.cpp:310
const ms_quant_method * getMethodByNumber(const int idx) const
Returns a quantitation method object by its number.
Definition: ms_quant_configfile.cpp:319
void setFileName(const char *name)
Call this member to set a custom file name to read from a different location.
Definition: ms_quant_configfile.cpp:123
An object of this class represent a single quantitation method from quantitation.xml.
Definition: ms_quant_method.hpp:51
virtual std::string validateShallow(const ms_xml_schema *pSchemaFileObj) const
Performs simple validation of the top-level elements only.
Definition: ms_quant_method.cpp:120
std::string getName() const
Returns the value of the name attribute.
Definition: ms_quant_method.cpp:923
void setName(const char *value)
Set a custom value for the name attribute.
Definition: ms_quant_method.cpp:931
virtual std::string validateDeep(const ms_xml_schema *pSchemaFileObj) const
Performs validation of all child elements in addition to 'shallow' validation.
Definition: ms_quant_method.cpp:148
std::string getNameSchemaType() const
Obtain a symbolic name for the "name attribute" schema type.
Definition: ms_quant_method.cpp:950