C# Class SimpleFramework.Xml.Core.CompositeMap

The CompositeMap is used to serialize and deserialize maps to and from a source XML document. The structure of the map in the XML format is determined by the annotation. Keys can be either attributes or elements, and values can be inline. This can perform serialization and deserialization of the key and value objects whether the object types are primitive or composite. <map> <entry key='1'> <value>one</value> </entry> <entry key='2'> <value>two</value> </entry> </map> For the above XML element map the element entry is used to wrap the key and value such that they can be grouped. This element does not represent any real object. The names of each of the XML elements serialized and deserialized can be configured.
Inheritance: Converter
Datei anzeigen Open project: ngallagher/simplexml

Public Methods

Method Description
CompositeMap ( Context context, Entry entry, Type type ) : SimpleFramework.Xml.Strategy

Constructor for the CompositeMap object. This will create a converter that is capable of writing map objects to and from XML. The resulting XML is configured by an annotation such that key values can attributes and values can be inline.

Populate ( InputNode node, Object result ) : Object

This populate method will read the XML element map from the provided node and deserialize its children as entry types. Each entry type must contain a key and value so that the entry can be inserted in to the map as a pair. If either the key or value is composite it is read as a root object, which means its Root annotation must be present and the name of the object element must match that root element name.

Read ( InputNode node ) : Object

This read method will read the XML element map from the provided node and deserialize its children as entry types. Each entry type must contain a key and value so that the entry can be inserted in to the map as a pair. If either the key or value is composite it is read as a root object, which means its Root annotation must be present and the name of the object element must match that root element name.

Read ( InputNode node, Object result ) : Object

This read method will read the XML element map from the provided node and deserialize its children as entry types. Each entry type must contain a key and value so that the entry can be inserted in to the map as a pair. If either the key or value is composite it is read as a root object, which means its Root annotation must be present and the name of the object element must match that root element name.

Validate ( InputNode node ) : bool

This validate method will validate the XML element map from the provided node and validate its children as entry types. Each entry type must contain a key and value so that the entry can be inserted in to the map as a pair. If either the key or value is composite it is read as a root object, which means its Root annotation must be present and the name of the object element must match that root element name.

Validate ( InputNode node, Class type ) : bool

This validate method will validate the XML element map from the provided node and validate its children as entry types. Each entry type must contain a key and value so that the entry can be inserted in to the map as a pair. If either the key or value is composite it is read as a root object, which means its Root annotation must be present and the name of the object element must match that root element name.

Write ( OutputNode node, Object source ) : void

This write method will write the key value pairs within the provided map to the specified XML node. This will write each entry type must contain a key and value so that the entry can be deserialized in to the map as a pair. If the key or value object is composite it is read as a root object so its Root annotation must be present.

Method Details

CompositeMap() public method

Constructor for the CompositeMap object. This will create a converter that is capable of writing map objects to and from XML. The resulting XML is configured by an annotation such that key values can attributes and values can be inline.
public CompositeMap ( Context context, Entry entry, Type type ) : SimpleFramework.Xml.Strategy
context Context /// this is the root context for the serialization ///
entry Entry /// this provides configuration for the resulting XML ///
type System.Type /// this is the map type that is to be converted ///
return SimpleFramework.Xml.Strategy

Populate() public method

This populate method will read the XML element map from the provided node and deserialize its children as entry types. Each entry type must contain a key and value so that the entry can be inserted in to the map as a pair. If either the key or value is composite it is read as a root object, which means its Root annotation must be present and the name of the object element must match that root element name.
public Populate ( InputNode node, Object result ) : Object
node InputNode /// this is the XML element that is to be deserialized ///
result Object /// this is the map object that is to be populated ///
return Object

Read() public method

This read method will read the XML element map from the provided node and deserialize its children as entry types. Each entry type must contain a key and value so that the entry can be inserted in to the map as a pair. If either the key or value is composite it is read as a root object, which means its Root annotation must be present and the name of the object element must match that root element name.
public Read ( InputNode node ) : Object
node InputNode /// this is the XML element that is to be deserialized ///
return Object

Read() public method

This read method will read the XML element map from the provided node and deserialize its children as entry types. Each entry type must contain a key and value so that the entry can be inserted in to the map as a pair. If either the key or value is composite it is read as a root object, which means its Root annotation must be present and the name of the object element must match that root element name.
public Read ( InputNode node, Object result ) : Object
node InputNode /// this is the XML element that is to be deserialized ///
result Object /// this is the map object that is to be populated ///
return Object

Validate() public method

This validate method will validate the XML element map from the provided node and validate its children as entry types. Each entry type must contain a key and value so that the entry can be inserted in to the map as a pair. If either the key or value is composite it is read as a root object, which means its Root annotation must be present and the name of the object element must match that root element name.
public Validate ( InputNode node ) : bool
node InputNode /// this is the XML element that is to be validate ///
return bool

Validate() public method

This validate method will validate the XML element map from the provided node and validate its children as entry types. Each entry type must contain a key and value so that the entry can be inserted in to the map as a pair. If either the key or value is composite it is read as a root object, which means its Root annotation must be present and the name of the object element must match that root element name.
public Validate ( InputNode node, Class type ) : bool
node InputNode /// this is the XML element that is to be validate ///
type Class /// this is the type to validate the input node against ///
return bool

Write() public method

This write method will write the key value pairs within the provided map to the specified XML node. This will write each entry type must contain a key and value so that the entry can be deserialized in to the map as a pair. If the key or value object is composite it is read as a root object so its Root annotation must be present.
public Write ( OutputNode node, Object source ) : void
node OutputNode /// this is the node the map is to be written to ///
source Object /// this is the source map that is to be written ///
return void