Try-catch added for XML.parse