libSBML C API
libSBML 5.8.0 C API
|
Reads an SBML Document into memory.
Functions | |
SBMLDocument_t * | readSBML (const char *filename) |
Reads an SBML document from the given file filename . More... | |
SBMLDocument_t * | readSBMLFromFile (const char *filename) |
SBMLDocument_t * | readSBMLFromString (const char *xml) |
Reads an SBML document from a string assumed to be in XML format. More... | |
SBMLReader_t * | SBMLReader_create (void) |
Creates a new SBMLReader and returns it. More... | |
void | SBMLReader_free (SBMLReader_t *sr) |
Frees the given SBMLReader. More... | |
int | SBMLReader_hasBzip2 () |
Predicate returning non-zero or zero depending on whether libSBML is linked with bzip2. More... | |
int | SBMLReader_hasZlib () |
Predicate returning non-zero or zero depending on whether underlying libSBML is linked with. More... | |
SBMLDocument_t * | SBMLReader_readSBML (SBMLReader_t *sr, const char *filename) |
Reads an SBML document from the given file. More... | |
SBMLDocument_t * | SBMLReader_readSBMLFromFile (SBMLReader_t *sr, const char *filename) |
SBMLDocument_t * | SBMLReader_readSBMLFromString (SBMLReader_t *sr, const char *xml) |
Reads an SBML document from the given XML string. More... | |
SBMLDocument_t* readSBML | ( | const char * | filename | ) |
Reads an SBML document from the given file filename
.
If filename
does not exist, or it is not an SBML file, an error will be logged in the error log of the SBMLDocument object returned by this method. Calling programs can inspect this error log to determine the nature of the problem. Please refer to the definition of SBMLDocument for more information about the error reporting mechanism.
SBMLDocument_t* readSBMLFromFile | ( | const char * | filename | ) |
SBMLDocument_t* readSBMLFromString | ( | const char * | xml | ) |
Reads an SBML document from a string assumed to be in XML format.
If the string does not begin with XML declaration,
<?xml version='1.0' encoding='UTF-8'?>
an XML declaration string will be prepended.
This method will report an error if the given string xml
is not SBML. The error will be logged in the error log of the SBMLDocument object returned by this method. Calling programs can inspect this error log to determine the nature of the problem. Please refer to the definition of SBMLDocument for more information about the error reporting mechanism.
SBMLReader_t* SBMLReader_create | ( | void | ) |
Creates a new SBMLReader and returns it.
By default XML Schema validation is off.
void SBMLReader_free | ( | SBMLReader_t * | sr | ) |
Frees the given SBMLReader.
int SBMLReader_hasBzip2 | ( | ) |
Predicate returning non-zero
or zero
depending on whether libSBML is linked with bzip2.
non-zero
if libSBML is linked with bzip2, zero
otherwise. int SBMLReader_hasZlib | ( | ) |
Predicate returning non-zero
or zero
depending on whether underlying libSBML is linked with.
non-zero
if libSBML is linked with zlib, zero
otherwise. SBMLDocument_t* SBMLReader_readSBML | ( | SBMLReader_t * | sr, |
const char * | filename | ||
) |
Reads an SBML document from the given file.
If filename does not exist or is not an SBML file, an error will be logged. Errors can be identified by their unique ids, e.g.:
SBMLReader_t *sr;
SBMLDocument_t *d;
sr = SBMLReader_create();
d = SBMLReader_readSBML(reader, filename);
if (SBMLDocument_getNumErrors(d) > 0)
{
if (XMLError_getId(SBMLDocument_getError(d, 0)) == SBML_READ_ERROR_FILE_NOT_FOUND)
if (XMLError_getId(SBMLDocument_getError(d, 0)) == SBML_READ_ERROR_NOT_SBML)
}
If the given filename ends with the suffix ".gz"
(for example, "myfile.xml.gz"
), the file is assumed to be compressed in gzip format and will be automatically decompressed upon reading. Similarly, if the given filename ends with ".zip"
or ".bz2"
, the file is assumed to be compressed in zip or bzip2 format (respectively). Files whose names lack these suffixes will be read uncompressed. Note that if the file is in zip format but the archive contains more than one file, only the first file in the archive will be read and the rest ignored.
SBMLDocument_t* SBMLReader_readSBMLFromFile | ( | SBMLReader_t * | sr, |
const char * | filename | ||
) |
SBMLDocument_t* SBMLReader_readSBMLFromString | ( | SBMLReader_t * | sr, |
const char * | xml | ||
) |
Reads an SBML document from the given XML string.
If the string does not begin with XML declaration:
<?xml version='1.0' encoding='UTF-8'?>
it will be prepended.
This method will log a fatal error if the XML string is not SBML. See the method documentation for readSBML(filename) for example error checking code.