Improve error emitting in bad xml parsing