Energy Core Library
Energy.Base.Xml Class Reference

XML support More...

Static Public Member Functions

static string Serialize (object data, string root, string space)
 Serialize object to XML More...
 
static string Serialize (object data)
 Serialize object to XML More...
 
static string Serialize (object data, string root)
 Serialize object to XML More...
 
static object Deserialize (string content, Type type, string[] root, string space)
 Deserialize object from XML, root alternatives allowed. More...
 
static TDeserialize Deserialize< TDeserialize > (string content)
 Generic XML deserialization method. More...
 
static object Deserialize (string content, Type type)
 Deserialize object from XML More...
 
static object Deserialize (string content, Type type, string root, string space)
 Deserialize object from XML More...
 
static object Deserialize (string content, Type type, string root)
 Deserialize object from XML More...
 
static object Deserialize (string content, Type type, string[] root)
 Deserialize object from XML, root alternatives allowed More...
 
static string ReadXmlString (XmlReader reader)
 Read XML string element More...
 
static void WriteXmlString (XmlWriter writer, string key, string value)
 Write XML string element More...
 
static void WriteXmlString (XmlWriter writer, string key, object value)
 Write XML string element More...
 
static void WriteXmlString (XmlWriter writer, string key, object value, bool empty)
 Write XML string element More...
 
static void Write (XmlWriter writer, string key, object value)
 Write XML element More...
 
static string GetXmlRoot (object _)
 
static string GetXmlRoot (Type type)
 
static string ExtractRoot (string xml)
 Extract root element from XML. More...
 
static string ExtractRootShort (string xml)
 Extract root element without namespace from XML. More...
 

Detailed Description

XML support

Member Function Documentation

◆ Deserialize() [1/5]

static object Energy.Base.Xml.Deserialize ( string  content,
Type  type,
string []  root,
string  space 
)
static

Deserialize object from XML, root alternatives allowed.

Parameters
contentstring
typeSystem.Type
rootstring[]
spacestring
Returns
object

◆ Deserialize() [2/5]

static object Energy.Base.Xml.Deserialize ( string  content,
Type  type 
)
static

Deserialize object from XML

MyDictionary x = (MyDictionary)Energy.Base.Xml.Deserialize(xml, typeof(MyDictionary));

Parameters
contentstring
typeSystem.Type
Returns
object

◆ Deserialize() [3/5]

static object Energy.Base.Xml.Deserialize ( string  content,
Type  type,
string  root,
string  space 
)
static

Deserialize object from XML

Parameters
contentstring
typeSystem.Type
rootstring
spacestring
Returns
object

◆ Deserialize() [4/5]

static object Energy.Base.Xml.Deserialize ( string  content,
Type  type,
string  root 
)
static

Deserialize object from XML

Parameters
contentstring
typeSystem.Type
rootstring
Returns
object

◆ Deserialize() [5/5]

static object Energy.Base.Xml.Deserialize ( string  content,
Type  type,
string []  root 
)
static

Deserialize object from XML, root alternatives allowed

Parameters
contentstring
typeSystem.Type
rootstring[]
Returns
object

◆ Deserialize< TDeserialize >()

static TDeserialize Energy.Base.Xml.Deserialize< TDeserialize > ( string  content)
static

Generic XML deserialization method.

Template Parameters
TDeserialize
Parameters
content
Returns

◆ ExtractRoot()

static string Energy.Base.Xml.ExtractRoot ( string  xml)
static

Extract root element from XML.

Parameters
xml
Returns

◆ ExtractRootShort()

static string Energy.Base.Xml.ExtractRootShort ( string  xml)
static

Extract root element without namespace from XML.

Parameters
xml
Returns

◆ GetXmlRoot() [1/2]

static string Energy.Base.Xml.GetXmlRoot ( object  _)
static

◆ GetXmlRoot() [2/2]

static string Energy.Base.Xml.GetXmlRoot ( Type  type)
static

◆ ReadXmlString()

static string Energy.Base.Xml.ReadXmlString ( XmlReader  reader)
static

Read XML string element

Parameters
readerXmlReader

◆ Serialize() [1/3]

static string Energy.Base.Xml.Serialize ( object  data,
string  root,
string  space 
)
static

Serialize object to XML

Object class must implement IXmlSerializable interface

string xml = Energy.Base.Xml.Serialize(myObject, "Root", "org.example.xns");

Parameters
dataObject
rootXML root
spaceXML namespace
Returns
XML string

◆ Serialize() [2/3]

static string Energy.Base.Xml.Serialize ( object  data)
static

Serialize object to XML

Object class must implement IXmlSerializable interface

string xml = Energy.Base.Xml.Serialize(myObject, "Root", "org.example.xns");

Parameters
dataObject
Returns
XML string

◆ Serialize() [3/3]

static string Energy.Base.Xml.Serialize ( object  data,
string  root 
)
static

Serialize object to XML

Object class must implement IXmlSerializable interface

string xml = Energy.Base.Xml.Serialize(myObject, "Root", "org.example.xns");

Parameters
dataObject
rootXML root
Returns
XML string

◆ Write()

static void Energy.Base.Xml.Write ( XmlWriter  writer,
string  key,
object  value 
)
static

Write XML element

Parameters
writerXmlWriter
keystring
valueobject

◆ WriteXmlString() [1/3]

static void Energy.Base.Xml.WriteXmlString ( XmlWriter  writer,
string  key,
string  value 
)
static

Write XML string element

Parameters
writerXmlWriter
keystring
valuestring

◆ WriteXmlString() [2/3]

static void Energy.Base.Xml.WriteXmlString ( XmlWriter  writer,
string  key,
object  value 
)
static

Write XML string element

Parameters
writerXmlWriter
keystring
valueobject

◆ WriteXmlString() [3/3]

static void Energy.Base.Xml.WriteXmlString ( XmlWriter  writer,
string  key,
object  value,
bool  empty 
)
static

Write XML string element

Parameters
writerXmlWriter
keystring
valueobject
emptybool

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