OpenMS
Loading...
Searching...
No Matches
XMLFile.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Timo Sachsenberg $
6// $Authors: Marc Sturm $
7// --------------------------------------------------------------------------
8
9#pragma once
10
11// OpenMS includes
14
15namespace OpenMS
16{
17 namespace Internal
18 {
19 class XMLHandler;
20
22 class OPENMS_DLLAPI XMLFile
23 {
24
25public:
26
30 XMLFile(const String& schema_location, const String& version);
32 virtual ~XMLFile();
33
45 bool isValid(const String& filename, std::ostream& os);
46
48 const String& getVersion() const;
49
50protected:
60 void parse_(const String& filename, XMLHandler* handler);
61
72 void parseBuffer_(const std::string & buffer, XMLHandler * handler);
73
82 void save_(const String& filename, XMLHandler* handler) const;
83
86
89
92
93 void enforceEncoding_(const String& encoding);
94 };
95
102 String OPENMS_DLLAPI encodeTab(const String& to_encode);
103 } // namespace Internal
104} // namespace OpenMS
105
106
Base class for loading/storing XML files that have a handler derived from XMLHandler.
Definition XMLFile.h:23
XMLFile()
Default constructor.
String schema_version_
Version string.
Definition XMLFile.h:88
String enforced_encoding_
Encoding string that replaces the encoding (system dependent or specified in the XML)....
Definition XMLFile.h:91
const String & getVersion() const
return the version of the schema
void enforceEncoding_(const String &encoding)
void parse_(const String &filename, XMLHandler *handler)
Parses the XML file given by filename using the handler given by handler.
XMLFile(const String &schema_location, const String &version)
Constructor that sets the schema location.
void save_(const String &filename, XMLHandler *handler) const
Stores the contents of the XML handler given by handler in the file given by filename.
virtual ~XMLFile()
Destructor.
String schema_location_
XML schema file location.
Definition XMLFile.h:85
void parseBuffer_(const std::string &buffer, XMLHandler *handler)
Parses the in-memory buffer given by buffer using the handler given by handler.
bool isValid(const String &filename, std::ostream &os)
Checks if a file validates against the XML schema.
Base class for XML handlers.
Definition XMLHandler.h:328
A more convenient string class.
Definition String.h:34
String encodeTab(const String &to_encode)
Encodes tabs '\t' in the string as 	 and returns the encoded string.
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19