The example of an Office Open XML relationship shown here is for the main body content of a Word 2007 document. This relationship is what tells Word 2007 that the file named document.xml contains the document body.
In the _rels folder on the top level of a ZIP package, the file named .rels defines relationships between core files in the ZIP package and the applicable Office Open XML schema.
Note An XML schema is a description of the structure and constraints of a given type of XML file, beyond the basic components of the XML language. Several schema are used in the Office Open XML Formats.
For example, take a look at one entry from the .rels file in a Word 2007 ZIP package, shown in the picture. This example defines the role of the file document.xml in this ZIP package.
- The Relationship Id (rId1 in this case) simply provides a unique identifier for the referenced file.
- The Type is the type of relationship being defined from the applicable Office Open XML schema. In this case, the file document.xml is being defined as type officeDocument. This information tells Word 2007 that the file document.xml contains the document body.
- The Target is the location of the referenced file within the ZIP package. In the example shown, the file document.xml is located in the word folder.
Other folders within a ZIP package may contain their own _rels folders to define relationships within that folder. For example, the main document folder always contains a document-level _rels folder. In the case of a Word document, the file contained in the document-level _rels folder is named document.xml.rels.
Note In addition to defining relationships for XML parts within a ZIP package, relationship files may also contain definitions for relationships to external files. For example, if your document text contains hyperlinks, the file document.xml.rels will include a separate relationship reference for each hyperlink.