More checking for malformed/invalid XML.