Base class for loading/storing XML files that have a handler derived from XMLHandler.
More...
#include <OpenMS/FORMAT/XMLFile.h>
|
| | XMLFile () |
| | Default constructor.
|
| |
| | XMLFile (const String &schema_location, const String &version) |
| | Constructor that sets the schema location.
|
| |
| virtual | ~XMLFile () |
| | Destructor.
|
| |
| bool | isValid (const String &filename, std::ostream &os) |
| | Checks if a file validates against the XML schema.
|
| |
| const String & | getVersion () const |
| | return the version of the schema
|
| |
|
| void | parse_ (const String &filename, XMLHandler *handler) |
| | Parses the XML file given by filename using the handler given by handler.
|
| |
| void | parseBuffer_ (const std::string &buffer, XMLHandler *handler) |
| | Parses the in-memory buffer given by buffer using the handler given by handler.
|
| |
| void | save_ (const String &filename, XMLHandler *handler) const |
| | Stores the contents of the XML handler given by handler in the file given by filename.
|
| |
| void | enforceEncoding_ (const String &encoding) |
| |
Base class for loading/storing XML files that have a handler derived from XMLHandler.
◆ XMLFile() [1/2]
◆ XMLFile() [2/2]
Constructor that sets the schema location.
◆ ~XMLFile()
◆ enforceEncoding_()
| void enforceEncoding_ |
( |
const String & |
encoding | ) |
|
|
protected |
◆ getVersion()
| const String & getVersion |
( |
| ) |
const |
return the version of the schema
◆ isValid()
| 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 .
- Parameters
-
| [in] | filename | The name of the file to validate. |
| [in,out] | os | The ostream where error messages should be send. |
- Exceptions
-
◆ parse_()
Parses the XML file given by filename using the handler given by handler.
- Parameters
-
| [in] | filename | The XML file to parse |
| [in] | handler | The XML handler to use for parsing |
- Exceptions
-
◆ parseBuffer_()
| void parseBuffer_ |
( |
const std::string & |
buffer, |
|
|
XMLHandler * |
handler |
|
) |
| |
|
protected |
Parses the in-memory buffer given by buffer using the handler given by handler.
- Parameters
-
| [in] | buffer | The buffer to parse |
| [in] | handler | The XML handler to use for parsing |
- Note
- Currently the buffer needs to be plain text, gzip buffer is not supported.
- Exceptions
-
◆ save_()
Stores the contents of the XML handler given by handler in the file given by filename.
- Parameters
-
| [in] | filename | The output filename |
| [in] | handler | The XML handler containing the content to write |
- Exceptions
-
◆ 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.
◆ schema_location_
XML schema file location.
◆ schema_version_