Einhugur Xml Serialization Framework for Einhugur Xml Plugin |

# XmlSerializer Class

A class to serialize complex class structures to XML with almost no coding needed.
For a class to be serialisable then it must have default constructor with no parameters.

Object
XmlSerializer

class XmlSerializer

#### Properties

ThrowIfMissingProperty | Set this property to true if you want to throw exceptions on missing properties when deserializing.

#### Methods

shared DeSerialize | De-serialises a class structure
shared DeSerialize | De-serialises a class structure, adding also Array of known classes to support de-serializing polymorphic structures.
shared Serialize | Serialises a class structure

#### Constants

Version = 2.0 |

#### Examples

You can fine tune your serialized data with the following attributes:
SerializeIgnore
Tells the serialiser to ignore this property.
Example Usage in the Attribute editor in Xojo:
SerializeIgnore
SerializeRename
Tells the serialiser to rename the property in the serialised data. for example if the Xojo property is called Y then you could serialize it as YCoord.
Example Usage in the Attribute editor in Xojo:
SerializeRename "YCoord”
SerializeArrayElementName
Defines a element name in the XML for array elements for the given property if this Attribute is not used then the element name will be Value.
Example Usage in the Attribute editor in Xojo:
SerializeArrayElementName "Employee”
SerializeArrayElementName
Defines a element name in the XML for array elements for the given property if this Attribute is not used then the element name will be Value.
Example Usage in the Attribute editor in Xojo:
SerializeArrayElementName "Employee"
SerializeArrayElementFactory
Tells the de-serialiser to use a custom class factory when constructing instances of class elements in object arrays.
(Note this attribute does nothing on non object arrays, for example it will be ignored on Integer array)
Example Usage in the Attribute editor in Xojo:
SerializeArrayElementFactory “MyCustomClassFactory"
This will make the the method called MyCustomClassFactory get called for each element of the array when the array is deserialised.
Signature of the factory method must be YourMethodName(className as String) as YourClassType where YourMethodName can be any name but must be same as you define in the attribute, and YourClassType is type of the class that you have in the array property.
SerializeOrder
Defines the order of the serialisation for the given property.
Example Usage in the Attribute editor in Xojo:
SerializeOrder 2
SerializeRequired
Attribute that can optionally be put on class properties. If class property has this and the property is missing when deserialising then exception is thrown regardless of value of the ThrowIfMissingProperty.
Example Usage in the Attribute editor in Xojo:
SerializeRequired
SerializeClassInfo
Attribute that can optionally be put on object type class properties. If it is set then the property will include extra class info in the serialised data to support polymorphism. (If for example the Property is Node as Object then with extra class info enabled the class value put in it can still work even if its of type of Subclass of the object).
Example Usage in the Attribute editor in Xojo:
SerializeClassInfo

#### Supported Platforms:

- macOS Intel 64 bit
- macOS Apple Silicon
- Windows 32 bit
- Windows 64 bit
- Windows ARM 64 bit
- Linux 32 bit
- Linux 64 bit
- Linux ARM 32 bit
- Linux ARM 64 bit
- iOS