Repair Word's document.xml White Space Expected Error
Question details
Repair or recover a Word document that reports a malformed XML error at a specific location in /word/document.xml.

- Product
- Microsoft Word
- Device & OS
- not provided
- Scenario
- The user needs to open and recover the contents of a DOCX file that reports a white space error.
- Observed behavior
- Word reports "White space expected" in /word/document.xml at a specific line and column.
Find the original DOCX file and note the line and column reported by Word. Check that the file is a genuine DOCX, not an older DOC file that was renamed with a .docx extension.
Use Word's Open and Repair Command
Try Word's built-in repair option before editing the document's internal XML.
In Word, select File > Open > Browse and locate the affected DOCX file.
Select the file, click the arrow next to Open, and choose Open and Repair.
If the document opens, check its contents and use File > Save As to save it under a new name.

Restore an Earlier Copy of the Document
Use an earlier version or backup if Word cannot repair the damaged file.
Inspect and Correct the DOCX XML
Use this advanced method when you have the original DOCX and the error identifies a line and column.
Work With Word Documents in WPS Writer
WPS Office is a free, lightweight alternative with a familiar interface for working with compatible Word documents. Open a recovered DOCX or an earlier copy in WPS Writer; it does not guarantee repair of malformed XML.

Frequently Asked Questions
What does "White space expected" in document.xml mean?
It means the XML parser encountered invalid syntax, such as missing whitespace between parts of a tag. The line and column in Word's message help you locate the surrounding markup in word/document.xml.
Can I fix the file by changing DOC to DOCX?
No. Renaming the extension does not convert an older DOC file into the ZIP-based DOCX format. Open a valid DOC in Word and use File > Save As to convert it, or find the original DOCX.
Why does the file show gibberish in a text editor?
DOCX files are ZIP-based packages, not plain text documents. Open a copy as a ZIP and inspect word/document.xml with an XML editor instead of opening the entire DOCX as text.
What can I do if Open and Repair recovers only some pages?
Check OneDrive or SharePoint Version history, backups, email attachments, and shared folders for an earlier copy. You can also consider a document recovery service, although full recovery is not guaranteed.
How should I package the XML files after editing?
Create a ZIP with the extracted DOCX contents at the ZIP root, including [Content_Types].xml and the word and _rels folders. Rename the ZIP extension to .docx, then test it in Word.




