An .xps file is a package in Microsoft’s XML Paper Specification 1.0
(2006): a ZIP archive organised by the Open Packaging
Conventions (OPC), the same packaging as DOCX
(later standardised as ECMA-376 Part 2). Files in the ZIP are called parts; part names
are case-insensitive paths starting with /; parts are linked by
relationships. The standardised version of the format is
OpenXPS, which changes the namespaces
and relationship types listed here.
Parts and their usual names
| Part | Usual name | Content type |
|---|---|---|
| Content types | /[Content_Types].xml | (OPC) maps extensions and part names to content types. |
| Package relationships | /_rels/.rels | application/vnd.openxmlformats-package.relationships+xml |
| Fixed document sequence | /FixedDocumentSequence.fdseq | application/vnd.ms-package.xps-fixeddocumentsequence+xml |
| Fixed document | /Documents/1/FixedDocument.fdoc | application/vnd.ms-package.xps-fixeddocument+xml |
| Fixed page | /Documents/1/Pages/1.fpage | application/vnd.ms-package.xps-fixedpage+xml |
| Remote resource dictionary | /Documents/1/Resources/Dictionaries/*.dict | application/vnd.ms-package.xps-resourcedictionary+xml |
| Font | /Documents/1/Resources/Fonts/*.ttf | application/vnd.ms-opentype |
| Obfuscated font | …/Resources/Fonts/GUID.odttf | application/vnd.ms-package.obfuscated-opentype |
| Images | /Documents/1/Resources/Images/* | image/jpeg, image/png, image/tiff, image/vnd.ms-photo (HD Photo) |
| Colour profile | /Documents/1/Metadata/*.icm | application/vnd.ms-color.iccprofile |
| Signature definitions | application/vnd.ms-package.xps-signaturedefinitions+xml | |
| Document structure | /Documents/1/Structure/DocStructure.struct | application/vnd.ms-package.xps-documentstructure+xml |
| Story fragments | /Documents/1/Structure/Fragments/1.frag | application/vnd.ms-package.xps-storyfragments+xml |
| Print ticket | /Metadata/Job_PT.xml, …/Page1_PT.xml | application/vnd.ms-printing.printticket+xml |
| Discard control | any name | application/vnd.ms-package.xps-discard-control+xml |
| Core properties | /docProps/core.xml | application/vnd.openxmlformats-package.core-properties+xml |
| Thumbnail | /Documents/1/Metadata/1.png | image/png or image/jpeg |
| Digital signature parts | /package/services/digital-signature/… | OPC signature origin, signature and certificate types. |
The names are recommendations; readers must follow relationships, not names. A
package can hold several fixed documents, each with its own pages and resources;
resources shared between documents go under /Resources/ with a GUID as
their name. The names and content types match those that ECMA-388 lists for OpenXPS,
which kept Microsoft’s content type strings; the print ticket content type is
Microsoft’s and is not in ECMA-388.
Relationship types
Relationship parts sit beside their source in a _rels folder, named
after it with .rels added (/Documents/1/Pages/_rels/1.fpage.rels).
Each Relationship element has Id, Type and
Target.
| Type | From | To |
|---|---|---|
http://schemas.microsoft.com/xps/2005/06/fixedrepresentation | package | The fixed document sequence: the start part. Exactly one. |
http://schemas.microsoft.com/xps/2005/06/required-resource | fixed page | Every font, image, colour profile and remote dictionary the page uses. |
http://schemas.microsoft.com/xps/2005/06/restricted-font | fixed document | A font whose licence allows only print and preview embedding. |
http://schemas.microsoft.com/xps/2005/06/documentstructure | fixed document | The document structure part (outline). |
http://schemas.microsoft.com/xps/2005/06/storyfragments | fixed page | The page’s story fragments part. |
http://schemas.microsoft.com/xps/2005/06/printticket | sequence, document or page | Print settings at that level. |
http://schemas.microsoft.com/xps/2005/06/signature-definitions | fixed document | Requested signatures (spots to sign). |
http://schemas.microsoft.com/xps/2005/06/discard-control | package | The discard control part, for streaming consumers. |
http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties | package | Title, author and other properties. |
http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail | package or page | A thumbnail image. |
http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin | package | The signature origin; signatures follow from it. |
These are the relationship types of ECMA-388 table D–6 with the XPS 1.0 base
http://schemas.microsoft.com/xps/2005/06; the
fixedrepresentation, documentstructure and
required-resource forms are also confirmed by MuPDF’s reader, which
additionally recognises required-resource#recursive.
Interleaving and streaming
OPC lets a part be split into pieces stored as separate ZIP entries,
/Documents/1/Pages/1.fpage/[0].piece, [1].piece … and
[n].last.piece, so that a printer can start before the whole package is
written. Readers join the pieces in order. A discard control part lists parts a
streaming consumer may drop once a given part has been read.
Namespaces
| Namespace | Used for |
|---|---|
http://schemas.microsoft.com/xps/2005/06 | Fixed document sequence, fixed document, fixed page and resource dictionary markup. |
http://schemas.microsoft.com/xps/2005/06/resourcedictionary-key | The x:Key attribute of resources. |
http://schemas.microsoft.com/xps/2005/06/documentstructure | Document structure and story fragments. |
http://schemas.microsoft.com/xps/2005/06/signature-definitions | Signature definitions. |
http://schemas.microsoft.com/xps/2005/06/discard-control | Discard control. |
http://schemas.openxmlformats.org/markup-compatibility/2006 | Markup compatibility: mc:AlternateContent, mc:Choice, mc:Fallback, mc:Ignorable, for extensions. |
Example
<!-- /_rels/.rels -->
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="R0" Target="/FixedDocumentSequence.fdseq"
Type="http://schemas.microsoft.com/xps/2005/06/fixedrepresentation"/>
<Relationship Id="R1" Target="/docProps/core.xml"
Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"/>
</Relationships>
Sources
- ECMA-388 – §9.1 part naming and Annex D (the same structures as XPS 1.0, with OpenXPS identifiers)
- MuPDF xps-doc.c – the XPS 1.0 relationship type strings
- Library of Congress: XPS – namespace, start part relationship, media type