Test and fixes for checking for invalid xml.