Search
Serializing the Schedule

XML Serialization

The saveTo and loadFrom methods of the Schedule class let you save and load schedules to/from XML documents. The saveToString and loadFromString methods let you encode or decode a schedule into/from an ASCII string, which could be used to store the whole schedule in a database table field or as a part of a larger file.

The serialization methods of the Schedule work by invoking the saveTo and loadFrom methods of the Item and Resource classes or the classes derived from them. If you define your own Item- or Resource-derived classes, you must override the saveTo and loadFrom methods and register the classes for serialization by calling the registerItemClass and registerResourceClass static methods of the Schedule.

JSON Serialization

Schedules can be serialized in JSON format. This can be used for interoperability with MindFusion JavaScript scheduling library, or for general storage in JSON files or databases. To serialize a Schedule to a JSON string, call its saveToJson method. To deserialize a schedule back from its JSON representation, call the loadFromJson method. Custom item classes can implement JSON serialization for their additional properties by overriding the saveTo(JsonObject) and loadFrom(JsonObject) methods of base Item class. Such classes must be registered for serialization by calling the registerItemClass method and providing a string identifier for the clientClass parameter.