XMarshal means 'XML Marshal'. Objects can be stored as and restored from well-formed XML document.
Advantage over standard Marshal:
Easily read and modified by text editor.
Dumped data can be used from non-ruby application.
XMarshal default encoding is UTF8 because of performance issue. If 'Uconv' is defined, XMarshal automatically configures itself to handle Japanese encoding. Input can be EUC, SJIS or ISO-2022-JP and output encoding is determined by $KCODE. So if Japanese processing needed, require as follows:
require 'uconv' require 'xmarshal'
Dump obj to port. Returns the resulting string if port is omitted.
Load object from port.
User defined classes must define initialize() without argument (or all arguments can be omitted.)
Marshaling following classes is not implemented yet.
Hash with keys other than String
Range, Regexp, Struct
Following classes cannot be dumped:
Dir, IO, File, Proc
Time#isdst (daylight saving time) is lost during marshaling.
Objects refereced from more than two places are dumped repeatedly.
Masaki Fukushima <email@example.com>