9

Today I have accidentally found out that the .docx is the same .zip (or there is no big difference between them). When you change the .docx to the .zip and open with WinRAR you see a bunch of XML files in the folders. In that XML file it is stored the text, fonts, owner, last modified and so on. In a word all the information is being stored as an XML data.

But the same is not right for .doc extension files. It is impossible to open them as .zip op as .rar.

So question: What is the advantage of storing .docx’s data in XML that Microsoft has changed the way of storing data? Indeed I want to know not the advantage of XML format but why Microsoft is using multiple XML files to store the .docx data. It turnes that .docx is not new format in the root.

6
  • Within 1 Minute.. 5 almost same answers. The Power of SO.
    – MRG
    Oct 9, 2009 at 10:02
  • 1
    Having data in XML format doesn't mean that it is not new format. You can't feed that XML into OpenOffice and make it render correctly. You must clearly define what will be XML structure, what attributes, what elements etc.
    – Janis Veinbergs
    Oct 9, 2009 at 10:03
  • 1
    Consider changing the title to something more informative. Oct 9, 2009 at 10:06
  • 2
    Of course it's a new format. Come on now.
    – Kyle Rozendo
    Oct 9, 2009 at 10:07
  • Dear Janis Veinbergs and Kyle Rozendo I have worked with XML and XSD a lot of times and I know how it works!!! Be attentive I said "in the root". You can't agree that it is the XML format just used, not a new format!!!!
    – Narek
    Oct 9, 2009 at 10:25

5 Answers 5

12

A .docx file can store embedded resources, like image files, not just XML files. Instead of encoding stuff in base64 or something and storing it within an XML file or inventing yet another binary serialization format, they decided to go with the standard ZIP format.

Beside that, XML is a very verbose file format containing lots of redundant patterns. You can get a high compression ratio for XML files.

By the way, I don't really get the "tricking us" part. Is it better to invent a new cryptic file format from scratch or use a standard, known format?

3
  • The main benefit I see is that there are Open APIs for actually creating these files, so creating .docx files from scratch is possible without spending lots on proprietary SDKs. The Microsoft SDK even supplies a document reflector that will generate C# code to generate a pre-made document from scratch. Oct 9, 2009 at 18:45
  • @Guard: Yeah. My answer addresses the original version of the question. The question has changed significantly since then ;) The original title was "Microsoft is tricking?"
    – mmx
    Oct 10, 2009 at 8:52
  • xml in itself does not make a format "known", .docx being one of the best examples.
    – wnrph
    Jan 16, 2012 at 8:06
5

The Wikipedia article sums it up pretty nicely:

"Microsoft came under increasing pressure to adopt an open file format, in particular several nations adopted rules that official documents should be in an open format."

Edit: And zipping it up makes a lot of sense, as the XML is very verbose, and naturally compresses really well.

2
  • 3
    "Open" does not mean "can be unzipped". Oct 9, 2009 at 10:01
  • 3
    Zipping has other advantages besides compression. It acts also as a container for multiple files.
    – Joey
    Oct 9, 2009 at 10:08
3

Using a renamed .zip file is a pretty common practice - for example Quake III .pak files are really .zip files. There's no point inventing your own compressed file format when perfectly good ones exist already.

1
  • 1
    More examples of using ZIP archives: Java .jar, Winamp .wsz/.wal (skins), Firefox .xpi (XPInstaller - themes, addons). (tar archives are also popular.) Oct 9, 2009 at 13:02
1

It's not only Office Open XML which uses zipped XML. Open Office's OpenDocument does the same behind the scenes.

There are a few advantages listed on the Wikipedia page on the Open Packaging Conventions:

Indirection

Take the example of a catalog where a logo is repeated 1,000 times. Using an indirection mechanism, if we want to change the logo we only need to change one entry in one file, with no searching involved because we know where to look. This increases maintainability substantially. If you want to change the layout of, say, the ZIP directories where your files are stored, it becomes a trivial matter, because you don't need to know every element that can point to file, they are all in one spot.

Chunking

It encourages documents to be split into small chunks. This is better for reducing the effect of file corruption. And better for data access: for example, all the style information in one XML part, each separate worksheet or table in their own different parts. This allows faster access and less object creation for clients, and makes it easier for multiple processes to be working on the same document.

Chunking also benefits programmers. Replacing one stylesheet with another becomes a ZIP file operation, not an XML operation. And it reduces the amount of things that a programmer needs to understand, because they can approach the chunks assuming that all the information on a topic is in that chunk: they are spared the mental toil of having to search through a big file with lots of extraneous elements.

Relative indirection

In the Open Packaging Conventions each file that has reference has its own _rels file with the indirection lists. This makes it easier to cut and paste some information with all its associated resources in some cases, provides name scoping to remove the chance of name clashing between files, and so on.

0

The biggest benefit is that you can get to your data by unzipping the file and copying the text from the xml files. This can be done with a zip utility & a text editor, even if you don't have a copy of Word 2007.

This is what makes the format more open that the older binary formats.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .