85

I want to see my .docx in its pure XML format.

Various application like internet browsers and visual studio will open the file up in Word for me.

I've also tried renaming the document to .xml extension and it just opens up in notepad showing a bunch of unintelligible text.

4 Answers 4

127

It's a zipped file. Rename it ending in .zip to view it.

9
  • 16
    ...then look at the word/document.xml file beneath it. May 25, 2016 at 3:22
  • 5
    when I upzip it, then modify document.xml, then zip folder and change to docx it does not open in Word. Say it is corrupted. How can I save modification in DOCX file? Aug 3, 2016 at 23:16
  • 3
    no need to rename. winrar and 7z can recognize the archive, just right click and select extract
    – phuclv
    Jun 6, 2017 at 14:13
  • 6
    My mind is blown. How did I not know this... Jul 5, 2017 at 15:45
  • 5
    @RenatGatin you must select all items in the folder and zip, not zip the folder itself. The [Content_Types].xml must be at the root of the zip file
    – phuclv
    Dec 12, 2018 at 8:58
19

Working on macOS, and don't want to install any software to see the XML from your .docx documents? Just open up the terminal and:

cd path/to/your/file.docx
unzip file.docx -d file-content

As mentioned above, .docx files are "disguised" zip files, and unzip is installed by default on macOS. After using it, your file-content folder will contain the various .xml files composing the Word document.

1
  • Renaming to .zip didn't work for me on mac without new software. This command method did work. Thank you.
    – Matt Keys
    Nov 3, 2022 at 16:17
1

I unpacked the zip file en edited the document.xml using Notepad++ (Plugins/XML tools/Check XML syntax now). Notepad++ noticed me at swapped elements, I placed the elements in a more logical order and repeated the steps until no more issues were found. Then I copied all the files directly into zip using Total Commander and finally renamed it back to *.docx. Word happily opened the file.

What I am saying is that if Word still refuses to open the file then there may be some more issues in one or more of xml files. Tip: use IE to quickly check an XML-file. If you see only flat text or even nothing at all, you can bet there is something wrong with the xml.

0

Just learned today that you can get at the raw XML from foo.docx from the cygwin ( linux-like ) commandline

unzip  -q -c 'foo.docx' word/document.xml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.