Einhugur Serialization Framework for Xojo |
|
XmlSerializer Class
A class to serialize complex class structures to XML with almost no coding needed.
Object
XmlSerializer
class XmlSerializer
Constructors
XmlSerializer | A constructor with no parameters for the XmlSerializer class. |
Properties
ThrowIfMissingProperty | Set this property to true if you want to throw exceptions on missing properties when deserializing. |
Methods
AddKnownClass | Adds known classes which is required when de-serializing polymorphic structures |
DeSerialize | De-serialize's a class structure |
Serialize | Serialize's a class structure |
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"
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 X CarbonMacOS X CocoaWin32 - WindowsLinux x86Unsupported Platforms: