working but half baked version of output format selection

using XML_Serializer, which generates a lot of notices and warnings.