Many applications integrate content with various additional resources. A Web browser, for example, displays a page that integrates HTML, image files, style sheets, and other types of content. Similarly, a word processor builds a document that combines text, style definitions, image files, and other elements. For the most part, applications use one of two approaches to organize the content: a flat-file organization where content is stored as separate files organized on disk, or binary container files where all the content is packaged in a single custom file. More and more, applications are tending towards the latter.

In the move toward open standards, a new file packaging technology has evolved as part of the 2007 Microsoft® Office System Open XML specification that was recently approved by the ECMA International standards organization. An underlying component of this standard is Open Packaging Conventions (OPC), which defines a structured means to store application data together with related resources using a standard ZIP file. This new packaging technology is already being used in several Microsoft products, including the 2007 Office System applications. The XML Paper Specification (XPS), which defines the new print-spool and document presentation format for Window Vista™, also implements the storage and transport of high-fidelity documents based on OPC. See the “Online Resources” sidebar for more information about the technologies discussed in this article.

So what makes the portable container technology offered by Open Packaging Conventions different? Since it is an open standard, OPC provides a container technology you can use without having to code your own custom binary container files. And it supports a number of enhanced features, including content addressable URIs, MIME types, relational structuring, and authentication and validation. With the Microsoft .NET Framework 3.0, the packaging APIs also offer options for encryption with rights management. Moreover, because they adhere to an open standard, package-based files can be accessed through high-level services such as workflow applications and virus scanners.

API support for the ECMA Open Packaging Conventions is built into Windows Vista and included as part of the .NET Framework 3.0 for use with Windows® XP and Windows Server® 2003. In this article, we’ll examine the new standard, showing how you can use the .NET Framework 3.0 APIs to organize your application’s storage of multiple data streams in a single portable package…

full source: MSDN Magazine August 2007