OpenMS
2.7.0
|
Base class for loading/storing XML files that have a handler derived from XMLHandler. More...
#include <OpenMS/FORMAT/XMLFile.h>
Public Member Functions | |
XMLFile () | |
Default constructor. More... | |
XMLFile (const String &schema_location, const String &version) | |
Constructor that sets the schema location. More... | |
virtual | ~XMLFile () |
Destructor. More... | |
bool | isValid (const String &filename, std::ostream &os) |
Checks if a file validates against the XML schema. More... | |
const String & | getVersion () const |
return the version of the schema More... | |
Protected Member Functions | |
void | parse_ (const String &filename, XMLHandler *handler) |
Parses the XML file given by filename using the handler given by handler . More... | |
void | parseBuffer_ (const std::string &buffer, XMLHandler *handler) |
Parses the in-memory buffer given by buffer using the handler given by handler . More... | |
void | save_ (const String &filename, XMLHandler *handler) const |
Stores the contents of the XML handler given by handler in the file given by filename . More... | |
void | enforceEncoding_ (const String &encoding) |
Protected Attributes | |
String | schema_location_ |
XML schema file location. More... | |
String | schema_version_ |
Version string. More... | |
String | enforced_encoding_ |
Encoding string that replaces the encoding (system dependent or specified in the XML). Disabled if empty. Used as a workaround for XTandem output xml. More... | |
Base class for loading/storing XML files that have a handler derived from XMLHandler.
XMLFile | ( | ) |
Default constructor.
Constructor that sets the schema location.
|
virtual |
Destructor.
|
protected |
const String& getVersion | ( | ) | const |
return the version of the schema
bool isValid | ( | const String & | filename, |
std::ostream & | os | ||
) |
Checks if a file validates against the XML schema.
Error messages are printed to the error stream, unless redirected with the attribute os
.
filename | The name of the file to validate. |
os | The ostream where error messages should be send. |
Exception::FileNotFound | is thrown if the file cannot be found |
Exception::NotImplemented | is thrown if there is no schema available for the file type |
|
protected |
Parses the XML file given by filename
using the handler given by handler
.
Exception::FileNotFound | is thrown if the file is not found |
Exception::ParseError | is thrown if an error occurred during the parsing |
|
protected |
Parses the in-memory buffer given by buffer
using the handler given by handler
.
Exception::ParseError | is thrown if an error occurred during the parsing |
|
protected |
Stores the contents of the XML handler given by handler
in the file given by filename
.
Exception::UnableToCreateFile | is thrown if the file cannot be created |
|
protected |
Encoding string that replaces the encoding (system dependent or specified in the XML). Disabled if empty. Used as a workaround for XTandem output xml.
|
protected |
XML schema file location.
|
protected |
Version string.