Open Packaging Conventions specification(开放式打包约定 (OPC) 规范)

Open Packaging Conventions Fundamentals

Introduces the OPC concepts that are required for using Packaging APIs.

This topic contains the following sections.

Introduction

The ECMA-376 OpenXML, 1st Edition, Part 2: Open Packaging Conventions (OPC) can be more easily understood through an analogy with real–world filing systems. People and businesses need to organize their information. Often, this information is tracked by using paperwork that is stored in folders, which are in turn, stored in filing cabinets. For each person and business, someone had to design a system to fit their needs, a system that would allow information to be accessed as needed.

A personalized filing system provides great advantages when used by someone who understands how the system works, but when someone new needs to access the system, how do they know where to find the information they need? Suddenly, the personalized filing system becomes less convenient. Applications face similar challenges in organizing data: what information is most important and how can developers ensure that it is easily accessible?

The OPC specification provides an answer to this question. A package, as described in the OPC, enables different applications to access key information from an OPC–based file in a standardized and predictable way. A package is like a filing cabinet whose basic organization is known to all the people and businesses that interact with it.

What are the Open Packaging Conventions (OPC)?

The Open Packaging Conventions (OPC) describes a new file technology that is documented in the ISO/IEC 29500 and ECMA 376 standards. Rather than a specific file format, OPC is a file technology for designing file formats with a shared, base architecture.

The OPC integrates elements of Zip, XML, and the Web technologies into an open, industry standard that makes it easier to organize, store, and transport application data.

OPC is the file technology base for many new formats supported by Microsoft products and a growing number of other new Microsoft and third-party applications. While these formats share OPC as a foundation, the data contained in a package file depends on the specific format.

Packages

A package is an aggregate of data components, like the filing cabinet (which is shown in the following illustration) is an aggregate of an individual or business‘s paperwork.

Unlike real–world filing systems, packages must conform to a predictable, conceptual organizational system (called the logical model), and predicatable physical characteristics (called the physical model). These standardized conformance requirements are described in the OPC.

Logical Model

The logical model describes a package as an aggregate of data structured as a directed graph. A generic directed graph is shown in the following diagram.

The vertices of a package graph are all URI-addressable resources, and the edges are links between those resources. The links of a package graph are relationships. In a package graph, the two resources connected by a relationship are known as the source and target of the relationship; in a generic graph, these would be known as the initial and terminal vertices, respectively.

The resource that is a source must be either the package itself or a data component (called a part) inside of the package. The target resource of a relationship can be any URI-addressable resource inside or outside of the package.

This model provides a format-independent way of structuring and accessing package data.

Physical Model

While the logical model describes the data structure of a package in the abstract, the physical model maps those logical concepts to a physical format. The result of this mapping is a physical package format. For example, the OPC provides a mapping of package concepts to the ZIP archive format; parts are treated as file items and appear in a directory-like hierarchy that is derived from part names. The result of this mapping is the physical, ZIP-based package format. To view the physical organization of any ZIP-based package, append the .zip extension to the package file name and open the archive using Windows Explorer or a ZIP utility. The following screen shot illustrates an XPS file that was opened for browsing:

Any individual or organization can design a physical package format by mapping logical package concepts to a desired physical format. As a result, package format designers can design and optimize a physical format for the specific needs of an application without compromising the logical structure of the package.

Currently, nearly all package formats are based on ZIP archives.

Existing ZIP-Based Package Formats

Examples of ZIP-based package formats include:

  • The OpenXML formats used in the 2007 Microsoft Office system:

    • Office Word 2007 documents (.docx)
    • Office Excel 2007 worksheets (.xlsx)
    • Office PowerPoint 2007 presentations (.pptx)
  • XPS documents (.xps)

Parts

In the analogy of a package to a real–world filing system, the parts in a package are like the folders in a filing cabinet. Parts store application data, like folders (which are shown in the following illustration) store personal or business information.

To further extend the analogy, the content of a part is data in the form of a byte stream like the content of a folder is information in the form of paperwork, as shown in the following illustration.

In the logical model of a package, parts are resources that are URI-addressable data components inside a package. A part consists of a byte stream of data and properties. The properties are specified in the OPC. The part‘s content type property uses a MIME-style media type to describe part content. The content types for parts are identified in a package-specific stream, called the Content Types stream. This stream contains XML markup that maps parts and extensions to content types. This XML markup is specified by the package format designer or in the OPC.

Parts also have the part name property: the URI of the part, relative to the root of the package. However, the part name depends on the physical mapping of the package format and, therefore, cannot be predicted reliably from one package format to another. A part that exists in more than one package format may not have the same part name in different package files. To find the current part name of a part in the current package, regardless of the package format, identify a relationship that targets the part and use the relationship to resolve the current part name.

For more information about parts and about finding their current part names, see the Parts Overview and the Finding the Core Properties Part how-to topic.

Relationships

In the analogy of a package to a real–world filing system, relationships can be used to navigate a package like information on a directory card can be used to navigate a filing system.

In the logical model of a package, relationships are the links that connect a source to a target. While the source is either the package or a part, the target can be any URI-addressable resource inside or outside of the package.

If the relationship target is inside the package, the targeted resource is a part in the package. If the target is outside of the package, the targeted resource can be any URI-addressable resource.

Only two kinds of resources can be the source of a relationship: the package itself and a part. If the source is the package, the relationship is called a package relationship; if the source is a part, the relationship is called a part relationship.

The relationship‘s properties provide access to the type of the relationship (the relationship type), target mode, and the relative URI of its target. The relationship type describes the connection between the relationship source and target. Relationship types are specified by the package format designer or in the OPC. The target mode of a relationship indicates whether its target is inside or outside of the package; if inside, the target is a part. The relative URI of a relationship target uses the URI of the source as its base.

If the target of a relationship is a part, the relative URI of the target can be resolved to its part name. For an example, see Resolving a Part Name from a Target URI. The resolution of a part name from the URI of a relationship‘s target is not contingent on the physical mapping of the package.

Relationships are serialized by using specialized XML markup, called relationship markup. An example of a serialized relationship is shown in the following markup.

XML

<Relationship Id="rId1"
    Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
    Target="word/document.xml" />

Storing Relationships: Relationships Parts

Relationships are stored in a specialized part, called a Relationships part. There is one Relationships part for each distinct relationship source in a package. All relationships that have the same source are stored in the same Relationships part.

The part name of a Relationships part is derived from the source URI of the relationships that are stored in the part. The part content of a Relationships part is the relationship markup, which is the serialized form of the stored relationships.

Digital Signatures

In a package, a digital signature (signature) can be validated, confirming that the signed contents of the package have not been modified since the signature was generated.

Important  Although signatures can be used to validate the identity of the package signer and originator, this must be performed by the package consumer.

A package signature can reference package components that have been signed. These components include XML markup that has been signed in application-specific Object elements. The signature can also include certificates (or links to them), which may be used in signature validation.

A package can have more than one signature, and each signature can reference any package component or application-specific content in an Object element that exists inside the signature markup.

The following table describes common package signature concepts.

Signature concepts Description
signature
A package digital signature. A digital signature generated for a package.

reference to a part
A reference to one part that has been signed.

reference to relationships
A reference to one or more relationships that have been signed and that are all stored in the same Relationships part.

reference to application data
A reference to application-specific data that has been signed and is contained in a specified object.

object that contains application data
An application-specific object that contains application data that may be signed when the signature is generated. This object is serialized as an element in the signature markup.

certificate
An X.509 certificate that is included when the signature is created and can be used in signature validation.

For more information about digital signatures, see the W3C recommendation XML Signature Syntax and Processing(http://go.microsoft.com/fwlink/p/?linkid=132847).

Related topics

Packaging API Programming Guide
Overviews
Getting Started with the Packaging API
External
ECMA-376 OpenXML
时间: 2024-10-11 16:21:58

Open Packaging Conventions specification(开放式打包约定 (OPC) 规范)的相关文章

OPC的理解Open Packaging Conventions

Open Packaging Conventions (OPC) OPC是一个文件容器技术.被微软创建,用来存储XML或者非XML文件结合起来的规范, 称为Open XML Paper Specification (OpenXPS)文档. 基于OPC文件格式的文档组合了文档元素无关的优势以及文件非常小,与正常的XML相比. 扩展形式为XML,或者ZIP. 1. 用法 XML Paper Specification (XPS)和Office Open XML (OOXML)使用Open Packa

约定和规范

以后写文章,还是参考别人的例子来规范下,特此记录: ■ 1 所有的语法.操作系统术语.文字示例均以插入代码的形式展现sdfsdfwdf ■ 2 变量.路径.系统消息以斜体显示 ■ 3 菜单选择示例.文件=>另存为,表示选择文件,然后选择另存为菜单 其他 参考自:www.bmc.com Conventions This document uses the following special conventions:■ All syntax, operating system terms, and

WPF 中的 Pack URI地(资源文件加载)

参考资源网http://msdn.microsoft.com/zh-cn/library/aa970069.aspx#Absolute_vs_Relative_Pack_URIs 在 Windows Presentation Foundation (WPF) 中,使用统一资源标识符 (URI) 标识和加载文件的方式有很多,包括: 指定当应用程序第一次启动时显示的用户界面 (UI). 加载图像. 导航到页 加载不可执行的数据文件. 此外,可以使用 URI 标识和加载位于各种位置的文件,这些位置包括

WPF用户控件实现类似WinForm的子窗口

1.WPF 介绍 .NET Framework 4 WPF 是下一代显示系统,用于生成Windows 客户端应用程序. 使用 WPF可以创建广泛的独立应用程序以及浏览器承载的应用程序. WPF 的核心是一个与分辨率无关并且基于向量的呈现引擎,旨在利用现代图形硬件的优势.WPF 通过一整套应用程序开发功能扩展了这个核心,这些功能包括Extensible Application Markup Language (XAML).控件.数据绑定.布局.2-D和3-D图形.动画.样式.模板.文档.媒体.文本

使用 Apache POI 处理 Microsoft Office 文档

原文同步至:http://www.waylau.com/apache-poi-handle-microsoft-documents/ POI 概述 Apache POI 项目的使命是创造和维护 Java API 操纵各种格式的文件,其中包括基于 Office Open XML 标准(OOXML)和微软的OLE 2 Compound Document 格式(OLE2).总之,你可以使用 Java 读写 MS Excel 文件.此外,您可以使用 Java 读取和写入 MS Word 和 MS Pow

【转】使用 NuGet 管理项目库-Phil Haack

原文地址:https://msdn.microsoft.com/zh-cn/magazine/hh547106.aspx 无论多么努力,Microsoft 也没办法提供开发人员所需要的每一个库. 虽然 Microsoft 在全球的员工人数接近 90,000,但全球的开发人员数以百万计. 指望 Microsoft 满足每一个人的需求是不现实的,也不可想像.因此,开发人员通常得自己动手解决问题,他们目前已经编写了成千上万的实用库,并将其发布到 Web 上. 如何共享如此多的库是一个令人头痛的问题. 

初识NuGet,实战NuGet

当你一直都在做小项目的时候,可能你永远也不会使用到NuGet工具.NuGet用于管理第三方的组件(无论是库还是工具),只需要建立一个NuGet Package的包,建在NuGet的站点上,就做到了共享便捷,更新同步的工作!类似于云,共享一片天空,而且是同一片云!对于NuGet的解释,专业的说法是:NuGet是一个.NET平台下的开源的项目,是Visual Studio 扩展,它能够简化在 Visual Studio 项目中添加.更新和删除库(部署为程序包)的操作. NuGet 产品也同样能够轻松

Nuget工具的安装和实际项目基本用法

转自:http://developer.51cto.com/art/201201/311365.htm 可以通过在控制台Package Manager Console 输出目录管理库 首先在在线的http://www.nuget.org/packages目录下找到对应库初始化路径 类似找到Json.NET http://www.nuget.org/packages/Newtonsoft.Json初始化路径为:我们能够现在操作都是基于在线Nuget官方数据源Package操作.当然我们可以PAck

10分钟进阶Nuget

nuget是什么 .net版的maven(java)? 如果你用过windows的chocolatey,mac的homebrew或许更容易理解他,先来回顾下以前我们是如何处理或者碰到过的问题. 1.假如我需要合并2个项目,这2个项目是不同的作者,项目中都使用到了log4net并且版本不同,那么你需要做一系列的改动来保证配置文件的正常工作. 2.同样在团队合作中,随便使用某个源代码管理工具,一般每个人在本地都有一个工程副本,对于第三方的(或者公用的)程序集(例如Common,Utility等)引用