Extract common XML functionality to new module