wordpress hit counter
About Open Packaging Conventions - OpenXMLDeveloper Wiki - About Open XML - OpenXML Developer

About Open Packaging Conventions

About Open XML

Open XML Developer Wiki.

OpenXMLDeveloper Wiki

About Open Packaging Conventions

OpenXMLDeveloper Wiki

Rate This

Open XML documents are ZIP files that contain XML, binary, with other types of embedded files.  You can append .ZIP to the file name, and use a variety of tools such as WinZip or Windows Explorer to examine the internals of the documents.

To write programs that access Open XML documents requires a library that can open a ZIP file.  You also need an XML programming application programming interface (API). The standard that defines how Open XML documents are stored in ZIP files is the Open Packaging Conventions. For more information about the Open Packaging Conventions, see ECMA 376-2 and ISO/IEC 29500-2. The specification contains details that are necessary for those who are implementing an API to access packages, such as using Open XML Format SDK 1.0, Open XML SDK 2.0 for Microsoft Office, or classes in the System.IO.Packaging namespace. However, for those who simply need to use APIs, there are just a few vital pieces of information needed.

If you are using a language or platform that doesn't contain a packages and document parts library, and instead are using a library that can read or write ZIP files, then you will need to know about the internals of the Open Packaging Conventions. If you are using the .NET Framework and the Open XML SDK or the classes in the System.IO.Packaging namespace, then you will not need to know as much about the mechanics of the Open Packaging Conventions. 

A ZIP package contains document parts. The Open XML Package specification defines documents as a set of XML files (document parts) and defines relationships between the document parts. The ZIP package is the ZIP file and the document parts are the files contained in the ZIP file. Like files on a disk, document parts can contain any type of content: text files, XML files, binary files, image files, or audio files.

Two (or more) source parts can have a relationship to the same target part—in other words, the network of parts forms a directed graph, not a hierarchy. A common example of this is having several parts referring to the same image—a corporate logo, for example. The corporate logo is stored in the package only once, and multiple parts can have a relationship referring to the same image part. So it follows that any document part can have relationships from multiple source parts as well as relationships targeting multiple child parts.

Relationships between parts are represented by XML files in the package.  While not complicated, if it is inaccurate, the package will be invalid.  There are four programming libraries that make it easier to manipulate OPC files.  Each of these libraries takes care of many of the issues around keeping the XML files in sync so that the package contains valid relationships.

  1. The Open XML SDK 2.0 provides a high-level programming interface that encapsulates information about the standard, including the capability to validate Open XML documents.
  2. System.IO.Packaging provides a lower-level programming interface that enables the creation of  documents with valid relationships, but it does not help with the underlying tasks around manipulating Open XML documents.
  3. The Windows 7 Packaging feature provides a COM-based programming interface that is similar in functionality to System.IO.Packaging.
  4. libOPC is an API for Open XML development, published on CodePlex.  This API is an open-source cross-platform API for developers working with Open Packaging Convention (OPC) packages as used by Open XML, XPS, and other formats.  Full source code is available and is written in portable C99, so can be used on Linux/Unix, Mac OS, Windows, Android, and other platforms.

For more information, see Essentials of the Open Packaging Conventions.

Sort by: Published Date | Most Recent | Most Useful
Comments
  • Good article, Helped me a lot.

Page 1 of 1 (1 items)