xml response writer refactoring