Handle errors in XML parsing