Open Packaging Conventions

The Open Packaging Conventions (OPC) provide a way to store multiple types of content (e.g., XML, images, and metadata) in a container, such as a ZIP archive, to fully represent a document. They describe a logical model for representing containment and relationships.

The recommended implementation for the OPC uses the ZIP archive format. One can inspect the structure of any OpenXML file by using any ZIP viewer. It is useful to inspect the contents of a small OpenXML file in this manner while reading this description. On the Windows operating system, one needs only to add a “.zip” extension to the filename and double-click.

Logically, an OpenXML document is an OPC package (§5:8). A package is a flat collection of parts (§5:8.1). Each part has a case-insensitive part name that consists of a slash-delimited sequence of segment names such as “/pres/slides/slide1.xml”(§5:8.1.1).

Each part also has a content type (§5:8.1.2). Physically, the ZIP archive is one package, each ZIP item in the archive is one part, and pathnames within the ZIP archive correspond directly to part names.

In the ZIP implementation, “/[ContentTypes].xml” allows a consumer to determine the content type of every part in the package (§2:9.2.6). The syntax and definition of media types follows section 3.7 of RFC 2616 (13).

Packages and parts can contain explicit relationships (§1:9.2) to other parts within the package, as well as to external resources. Every explicit relationship has a relationship ID, which allows a part’s content to refer to it; and a type, which allows an application to decide how to process it. Relationship types are named using URIs, enabling non-coordinating parties to safely create new types without conflict.

The set of explicit relationships for a given source package or part is stored in a relationships part. The relationships part for the package as a whole is called “/_rels/.rels”; the relationships part for a part called “/a/b/c.xml” is called “/a/b/_rels/c.xml.rels”. The relationships parts (and, in the ZIP implementation, the content-type part) are the only specially named parts in a package. To open a package, an application must parse the package-relationships part and follow the relationships of appropriate type.

All other parts in an OpenXML document hold OpenXML, custom XML, or content of arbitrary type such as multimedia objects. The ability of a part to hold custom XML is a particularly powerful mechanism for embedding business data and metadata.