Pack URI Scheme

RFC 3986 provides an extensible mechanism for defining new kinds of URIs based on new schemes. Schemes are the prefix in a URI before the colon.
example: : “http”, “ftp”, “file”
This Open Packaging specification defines a specific URI scheme used to refer to parts in a package: the pack scheme. A URI that uses the pack scheme is called a pack URI.

The pack URI grammar is defined as follows:

pack_URI 	= "pack://" authority [ "/" | path ]	
authority	= *( unreserved | sub-delims | pct-encoded )
path	= 1*( "/" segment )
segment	= 1*( pchar )

unreserved, sub-delims, pchar and pct-encoded are defined in RFC 3986

The authority component contains an embedded URI that points to a package. The package implementer shall create an embedded URI that meets the requirements defined in RFC 3986 for a valid URI. [M7.1] §B.3 describes the rules for composing pack URIs by combining the URI of an entire package resource with a part name.

The package implementer shall not create an authority component with an unescaped colon (:) character. [M7.4] Consumer applications, based on the obsolete URI specification RFC 2396, might tolerate the presence of an unescaped colon character in an authority component. [O7.1]

The optional path component identifies a particular part within the package. The package implementer shall only create path components that conform to the part naming rules. When the path component is missing, the resource identified by the pack URI is the package as a whole. [M7.2]

In order to be able to embed the URI of the package in the pack URI, it is necessary either to replace or to percent-encode occurrences of certain characters in the embedded URI. For example, forward slashes (/) are replaced with commas (,). The rules for these substitutions are described in §B.3.

The optional query component in a pack URI is ignored when resolving the URI to a part.

A pack URI might have a fragment identifier as specified in RFC 3986. If present, this fragment applies to whatever resource the pack URI identifies.

example:

Example B–1. Using the pack URI to identify a part

The following URI identifies the “/a/b/foo.xml” part within the “http://www.openxmlformats.org/my.container” package resource:

pack://http%3c,,www.openxmlformats.org,my.container/a/b/foo.xml
example:

Example B–2. Equivalent pack URIs

The following pack URIs are equivalent:

pack://http%3c,,www.openxmlformats.org,my.container
pack://http%3c,,www.openxmlformats.org,my.container/
example:

Example B–3. A pack URI with percent-encoded characters

The following URI identifies the “/c/d/bar.xml” part within the “http://myalias:pswr@www.my.com/containers.aspx?my.container” package:

pack://http%3c,,myalias%3cpswr%40www.my.com,containers.aspx%3fmy.container
/c/d/bar.xml