Moving XML printing functionality to separate class