XML is intolerant of errors. This program will automatically salvage XML files by finding the first XML error, then truncating a configurable number of characters before the error and finally using the great xmllint to recover the xml file by automatically adding the correct end tags. The program starts with a default of 50 characters truncation.
This truncation value may need to be changed if the truncation happens in the middle of a complex tag as xmllint may not know how to recover the file correctly. The extra truncation is needed in the first place because the XML validator used is not able to perfectly identify where the XML corruption begins and will often not flag the corruption for several characters after it begins.