How To Repair A Corrupt Xml File
Today I ran into a lot of trouble. I was working on a Word (2016) document. Happily typing away and saving the document from time to time to SharePoint Online.
When I was finished, I decided to share the document and examination the link provided to me. Instead of the document, I got an mistake message. Non to hopeful, I decided to open the certificate in Word instead of Discussion Online.
And then it happened….
Ok. These things practise happen. I guess. And I'one thousand not fainthearted. So, I decided to solve this.
I have. But I has been a struggle. Allow me guide you through the process.
Office XML format
First thing to remember is that Part uses the Office XML format. Every .docx certificate is basically a nada file. The content is stored within, including the document metadata, structure and even some SharePoint metadata.
Then, footstep 1: replace the .docx with .zip.
Adjacent, it is time to detect the culprit. In this case, it is the document.xml file. This can be found in de give-and-take folder.
Step 2: Open document.xml with Notepad++
To open up this XML file and recover the document, I used Notepad++. I even used the XML plugins, but these weren't useful to me (in the end). So, let'southward open the document and call back the error: Line two.
Ok. And so the fault'south in line 2. Line 2 has all the XML code stored within. And I can't use the XML plugins, because of the error. We tin can get around this, thanks to some information on the web.
Stride 3: Supplant some code
Within the XML file, supersede all >< with >\r\n<.
What this does, is create a new line for every XML line. And this is very handy.
You will see all the XML now.
Footstep 4: Save the certificate.xml back
A weird footstep this, just it works. Relieve the document.xml again. Apply the Save a re-create part for this. Notepad++ will detect errors in the XML and won't relieve the original. But a copy (using the aforementioned name) will do the trick.
Afterward saving the file, include it into the .zip certificate and rename it back to .docx.
Step 5: Done
Yep, correct. No, information technology's not that easy. At present that you've saved the document.xml file back into the .docx file, Word will provide us with some more information. Endeavor to open up the certificate again. You volition get the same fault, but this fourth dimension: the exact line y'all need.
In this example, line 720. Don't carp with the column.
Step 6: Modify the document.xml.
Now we know what to await for. Don't carp trying to get to the reason for the error. All lawmaking looks healthy to me. Merely get to the line stated.
Here you will either find a line commencement with </ or <.
At present comes the hard office. Find the entire department of the line. In my instance, the line is </west:pict>, so I have to look for the connecting <due west:pict> role.
This part begins at line 653. I select all of the code and but delete information technology.
Now salve the file again, place it back into the .zip file. Rename the .zip file to .docx and try to open up information technology. In my instance, I got another error message. This one also to do with <westward:pict>. I removed that section besides.
Pace 7: Success
In the end, when you take removed all the sections, Word will open the certificate. In my case, no content was harmed using this process. And I was very, very happy.
Success!
How To Repair A Corrupt Xml File,
Source: https://alberthoitingh.com/2016/09/05/restore-a-corrupt-wordxml-document/
Posted by: ellispowee1981.blogspot.com

0 Response to "How To Repair A Corrupt Xml File"
Post a Comment