Minor cleanup: move xml related methods together.