XML Generator refactoring