How to Unlock a Corrupt & Unreadable .XML File

By Lisa M. McMahon

Updated September 28, 2017

Extensible Markup Language (XML) is a text format designed to transport and store data. It is a markup language similar to HTML except that it does not display data nor does it have predefined tags. The World Wide Web Consortium (W3C) specification states that if an XML document has errors, the program processing it should stop immediately. Fortunately, since an XML document is just plain text, you can open and fix a corrupt or unreadable file in a text editor.

Open the corrupt .xml file in Internet Explorer and note any error messages displayed and the line where they occurred. If an error message is displayed, it can help troubleshoot the problem. Close Internet Explorer.

Open the .xml file in Windows Notepad or other text editor. Turn on Notepad’s status bar by clicking “View” then selecting “Status Bar.” The status bar will show you line and column numbers, which you will need if Internet Explorer displayed the line number of the error.

Remove any line breaks that occur in the middle of tags. For example would be correct syntax for an XML tag but would not.

Remove any illegal characters located between tag pairs. For example, an ampersand must be indicated as “amp” and not “&.”

Save the file and open it in Internet Explorer to re-validate. Continue fixing errors in Notepad as indicated in Internet Explorer until the browser displays the entire file.


Use an XML File Validator to verify the validity of an XML file.