refactoring about read/write methods in xml, yaml and template