encoding serialized trees into xml trees