|
| | UnimodXMLFile () |
| | Default constructor.
|
| |
| | ~UnimodXMLFile () override |
| | Destructor.
|
| |
| void | load (const std::string &filename, std::vector< ResidueModification * > &modifications) |
| | loads data from unimod.xml file
|
| |
| | XMLFile () |
| | Construct an XMLFile without schema info; schema_location_ remains unset, so isValid cannot be used until derived-class logic initializes schema_location_ before calling isValid.
|
| |
| | XMLFile (const std::string &schema_location, const std::string &version) |
| | Construct with a schema location for later isValid calls.
|
| |
| virtual | ~XMLFile () |
| | Virtual destructor — defaulted; allows safe deletion through a base-class pointer.
|
| |
| bool | isValid (const std::string &filename, std::ostream &os) |
| | Check if filename validates against the bound XML schema.
|
| |
| const std::string & | getVersion () const |
| | Return the schema version string passed to the parameterised constructor; empty for default-constructed instances.
|
| |
|
| void | parse_ (const std::string &filename, XMLHandler *handler, bool namespace_aware=false) |
| | Parse the XML file at filename through handler.
|
| |
| void | parseBuffer_ (const std::string &buffer, XMLHandler *handler, bool namespace_aware=false) |
| | Parse an in-memory XML buffer through handler.
|
| |
| void | save_ (const std::string &filename, XMLHandler *handler) const |
| | Stores the contents of the XML handler given by handler in the file given by filename.
|
| |
| void | enforceEncoding_ (const std::string &encoding) |
| | Set or clear the XML-encoding override applied to subsequent parse_ / parseBuffer_ calls.
|
| |
| std::string | schema_location_ |
| | Path of the XML schema for validation; empty when the default constructor was used (isValid then throws NotImplemented).
|
| |
| std::string | schema_version_ |
| | Schema version string returned by getVersion.
|
| |
| std::string | enforced_encoding_ |
| | Optional XML encoding override applied to the InputSource in parse_ and parseBuffer_; empty disables the override. Used as a workaround for XTandem output XML which carries an encoding the parser otherwise stumbles on.
|
| |
Used to load XML files from unimod.org files.
| bool loadInSlices_ |
( |
const std::string & |
file, |
|
|
std::vector< ResidueModification * > & |
modifications |
|
) |
| |
|
private |
Parses a large UniMod file in slices on several threads; false if it did not (the caller parses it as a whole)
The <umod:modifications> section of file is cut at end tags of <umod:mod> elements into a few slices; each is parsed with its own handler as the file with the other slices left out, and the modifications are appended to modifications in the order of the file. Only for a regular file whose text the handler provably reads the same way in slices: an XML declaration and comments before the root element only, no comments, CDATA sections, processing instructions or document type declaration after that, nothing the handler acts on outside the section, and in it complete <umod:mod> elements with specificities, neutral losses, deltas and elements nested as in unimod.xml and positions the handler knows. A file that is not like that, any error in a slice (whose messages are not written) or any failure (e.g. memory) leaves modifications unchanged and returns false, so that the result, messages and errors are those of the whole file.