Resolving a Pack URI to a Resource

The following is an algorithm for resolving a pack URI to a resource (either a package or a part):

  1. Parse the pack URI into the potential three components: scheme, authority, path, as well as any fragment identifier.

  2. In the authority component, replace all commas (,) with forward slashes (/).

  3. Un-percent-encode ASCII characters in the resulting authority component.

  4. The resultant authority component is the URI for the package as a whole.

  5. If the path component is empty, the pack URI resolves to the package as a whole and the resolution process is complete.

  6. A non-empty path component shall be a valid part name. If it is not, the pack URI is invalid.

  7. The pack URI resolves to the part with this part name in the package identified by the authority component.

example:

Example B–4. Resolving a pack URI to a resource

Given the pack URI:

pack://http%3c,,www.my.com,packages.aspx%3fmy.package/a/b/foo.xml

The components:

<authority>= http%3c,,www.my.com,packages.aspx%3fmy.package
<path>= /a/b/foo.xml

Are converted to the package URI:

http://www.my.com/packages.aspx?my.package

And the path:

/a/b/foo.xml

Therefore, this URI refers to a part named “/a/b/foo.xml” in the package at the following URI: http://www.my.com/packages.aspx?my.package.