Refactored the XMLTool.java