OmegaEngine API  1.0.3
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
Static Public Member Functions | Public Attributes | List of all members
OmegaEngine.Storage.XmlStorage Class Reference

Provides easy serialization to XML files (optionally wrapped in ZIP archives). More...

Static Public Member Functions

static T LoadXml< T > ([NotNull] Stream stream)
 Loads an object from an XML file. More...
 
static T LoadXml< T > ([NotNull, Localizable(false)] string path)
 Loads an object from an XML file. More...
 
static T FromXmlString< T > ([NotNull, Localizable(false)] string data)
 Loads an object from an XML string. More...
 
static void SaveXml< T > ([NotNull] this T data, [NotNull] Stream stream, [CanBeNull, Localizable(false)] string stylesheet=null)
 Saves an object in an XML stream ending with a line break. More...
 
static void SaveXml< T > ([NotNull] this T data, [NotNull, Localizable(false)] string path, [CanBeNull, Localizable(false)] string stylesheet=null)
 Saves an object in an XML file ending with a line break. More...
 
static string ToXmlString< T > ([NotNull] this T data, [CanBeNull, Localizable(false)] string stylesheet=null)
 Returns an object as an XML string ending with a line break. More...
 
static T LoadXmlZip< T > ([NotNull] Stream stream, [CanBeNull, Localizable(false)] string password=null, [NotNull] params EmbeddedFile[] additionalFiles)
 Loads an object from an XML file embedded in a ZIP archive. More...
 
static T LoadXmlZip< T > ([NotNull, Localizable(false)] string path, [CanBeNull, Localizable(false)] string password=null, [NotNull] params EmbeddedFile[] additionalFiles)
 Loads an object from an XML file embedded in a ZIP archive. More...
 
static void SaveXmlZip< T > ([NotNull] this T data, [NotNull] Stream stream, [CanBeNull, Localizable(false)] string password=null, [NotNull] params EmbeddedFile[] additionalFiles)
 Saves an object in an XML file embedded in a ZIP archive. More...
 
static void SaveXmlZip< T > ([NotNull] this T data, [NotNull, Localizable(false)] string path, [CanBeNull, Localizable(false)] string password=null, [NotNull] params EmbeddedFile[] additionalFiles)
 Saves an object in an XML file embedded in a ZIP archive. More...
 

Public Attributes

const string XsiNamespace = "http://www.w3.org/2001/XMLSchema-instance"
 The XML namespace used for XML Schema instance. More...
 

Detailed Description

Provides easy serialization to XML files (optionally wrapped in ZIP archives).

Member Function Documentation

static T OmegaEngine.Storage.XmlStorage.FromXmlString< T > ( [NotNull, Localizable(false)] string  data)
inlinestatic

Loads an object from an XML string.

Template Parameters
TThe type of object the XML string shall be converted into.
Parameters
dataThe XML string to be parsed.
Returns
The loaded object.
Exceptions
InvalidDataExceptionA problem occurred while deserializing the XML data.
static T OmegaEngine.Storage.XmlStorage.LoadXml< T > ( [NotNull] Stream  stream)
inlinestatic

Loads an object from an XML file.

Template Parameters
TThe type of object the XML stream shall be converted into.
Parameters
streamThe stream to read the encoded XML data from.
Returns
The loaded object.
Exceptions
InvalidDataExceptionA problem occurred while deserializing the XML data.
static T OmegaEngine.Storage.XmlStorage.LoadXml< T > ( [NotNull, Localizable(false)] string  path)
inlinestatic

Loads an object from an XML file.

Template Parameters
TThe type of object the XML stream shall be converted into.
Parameters
pathThe path of the file to load.
Returns
The loaded object.
Exceptions
IOExceptionA problem occurred while reading the file.
UnauthorizedAccessExceptionRead access to the file is not permitted.
InvalidDataExceptionA problem occurred while deserializing the XML data.

Uses AtomicRead internally.

static T OmegaEngine.Storage.XmlStorage.LoadXmlZip< T > ( [NotNull] Stream  stream,
[CanBeNull, Localizable(false)] string  password = null,
[NotNull] params EmbeddedFile[]  additionalFiles 
)
inlinestatic

Loads an object from an XML file embedded in a ZIP archive.

Template Parameters
TThe type of object the XML stream shall be converted into.
Parameters
streamThe ZIP archive to load.
passwordThe password to use for decryption; null for no encryption.
additionalFilesAdditional files stored alongside the XML file in the ZIP archive to be read.
Returns
The loaded object.
Exceptions
ZipExceptionA problem occurred while reading the ZIP data or if password is wrong.
InvalidDataExceptionA problem occurred while deserializing the XML data.
static T OmegaEngine.Storage.XmlStorage.LoadXmlZip< T > ( [NotNull, Localizable(false)] string  path,
[CanBeNull, Localizable(false)] string  password = null,
[NotNull] params EmbeddedFile[]  additionalFiles 
)
inlinestatic

Loads an object from an XML file embedded in a ZIP archive.

Template Parameters
TThe type of object the XML stream shall be converted into.
Parameters
pathThe ZIP archive to load.
passwordThe password to use for decryption; null for no encryption.
additionalFilesAdditional files stored alongside the XML file in the ZIP archive to be read.
Returns
The loaded object.
Exceptions
IOExceptionA problem occurred while reading the file.
UnauthorizedAccessExceptionRead access to the file is not permitted.
ZipExceptionA problem occurred while reading the ZIP data or if password is wrong.
InvalidDataExceptionA problem occurred while deserializing the XML data.

Uses AtomicRead internally.

static void OmegaEngine.Storage.XmlStorage.SaveXml< T > ( [NotNull] this T  data,
[NotNull] Stream  stream,
[CanBeNull, Localizable(false)] string  stylesheet = null 
)
inlinestatic

Saves an object in an XML stream ending with a line break.

Template Parameters
TThe type of object to be saved in an XML stream.
Parameters
dataThe object to be stored.
streamThe stream to write the encoded XML data to.
stylesheetThe path of an XSL stylesheet for T ; can be null.
static void OmegaEngine.Storage.XmlStorage.SaveXml< T > ( [NotNull] this T  data,
[NotNull, Localizable(false)] string  path,
[CanBeNull, Localizable(false)] string  stylesheet = null 
)
inlinestatic

Saves an object in an XML file ending with a line break.

This method performs an atomic write operation when possible.

Template Parameters
TThe type of object to be saved in an XML stream.
Parameters
dataThe object to be stored.
pathThe path of the file to write.
stylesheetThe path of an XSL stylesheet for T ; can be null.
Exceptions
IOExceptionA problem occurred while writing the file.
UnauthorizedAccessExceptionWrite access to the file is not permitted.

Uses

See Also
AtomicWrite

internally.

static void OmegaEngine.Storage.XmlStorage.SaveXmlZip< T > ( [NotNull] this T  data,
[NotNull] Stream  stream,
[CanBeNull, Localizable(false)] string  password = null,
[NotNull] params EmbeddedFile[]  additionalFiles 
)
inlinestatic

Saves an object in an XML file embedded in a ZIP archive.

Template Parameters
TThe type of object to be saved in an XML stream.
Parameters
dataThe object to be stored.
streamThe ZIP archive to be written.
passwordThe password to use for encryption; null for no encryption.
additionalFilesAdditional files to be stored alongside the XML file in the ZIP archive; can be null.
static void OmegaEngine.Storage.XmlStorage.SaveXmlZip< T > ( [NotNull] this T  data,
[NotNull, Localizable(false)] string  path,
[CanBeNull, Localizable(false)] string  password = null,
[NotNull] params EmbeddedFile[]  additionalFiles 
)
inlinestatic

Saves an object in an XML file embedded in a ZIP archive.

Template Parameters
TThe type of object to be saved in an XML stream.
Parameters
dataThe object to be stored.
pathThe ZIP archive to be written.
passwordThe password to use for encryption; null for no encryption.
additionalFilesAdditional files to be stored alongside the XML file in the ZIP archive; can be null.
Exceptions
IOExceptionA problem occurred while writing the file.
UnauthorizedAccessExceptionWrite access to the file is not permitted.

Uses

See Also
AtomicWrite

internally.

static string OmegaEngine.Storage.XmlStorage.ToXmlString< T > ( [NotNull] this T  data,
[CanBeNull, Localizable(false)] string  stylesheet = null 
)
inlinestatic

Returns an object as an XML string ending with a line break.

Template Parameters
TThe type of object to be saved in an XML string.
Parameters
dataThe object to be stored.
stylesheetThe path of an XSL stylesheet for T ; can be null.
Returns
A string containing the XML code.

Member Data Documentation

const string OmegaEngine.Storage.XmlStorage.XsiNamespace = "http://www.w3.org/2001/XMLSchema-instance"

The XML namespace used for XML Schema instance.


The documentation for this class was generated from the following file: