cleanup
use StringBuilder
cleanup
archiveState — we should use compact xml format to save a bit memory
use serializeIfNotDefault
fix isEmpty
fix test data