XMLStorageManager

class XMLStorageManager(*args)

Storage manager that drives a XML file.

This class allows one to read and write objects from an XML file.

Parameters:
fileNamestr

Name of the file containing the study.

compressionLevelint, optional

Compression level of the resulting XML file, in the range 0,…,9 (0=no compression, 9=best compression). The compression is done only if the XML lib has been compiled with zlib support. The default value is given by ‘XMLStorageManager-DefaultCompressionLevel’ in ResourceMap.

Methods

getClassName()

Accessor to the object's name.

getDefaultStudyVersion()

Return the version of the study that the manager can read/write.

getFileName()

Get the name of the file containing the study.

getStudyVersion()

Get the study version.

setFileName(fileName)

Set the name of the file containing the study.

setStudyVersion(version)

Set the study version.

See also

StorageManager

Examples

>>> import openturns as ot
>>> # Create a study:
>>> myStudy = ot.Study()
>>> myStudy.setStorageManager(ot.XMLStorageManager('myStudy.xml'))  
>>> myStudy2 = ot.Study()  
>>> myStudy2.setStorageManager(ot.XMLStorageManager('myStudy2.xml.gz', 5))  
>>> # Add an object in the study:
>>> simulationResult = ot.ProbabilitySimulationResult(ot.ThresholdEvent(), 0.5, 0.01, 150, 4)  
>>> myStudy.add('simulationResult', simulationResult)  
>>> # Save the Study in the file myStudy.xml:
>>> myStudy.save()  
__init__(*args)
getClassName()

Accessor to the object’s name.

Returns:
class_namestr

The object class name (object.__class__.__name__).

getDefaultStudyVersion()

Return the version of the study that the manager can read/write.

Returns:
versionpositive int

Version of the study that the manager can read/write.

getFileName()

Get the name of the file containing the study.

Returns:
fileNamestr

Name of the file containing the study.

getStudyVersion()

Get the study version.

Returns:
versionpositive int

Study version.

setFileName(fileName)

Set the name of the file containing the study.

Parameters:
fileNamestr

Name of the file containing the study.

setStudyVersion(version)

Set the study version.

Parameters:
versionpositive int

Study version.

Examples using the class

Save/load a study

Save/load a study