refactoring mergeXML.