Handle errors when parsing XML files using Expat

Change-Id: Iaf419ed6ea2fcce5965d77cbf6bc8a4753687532