This post is migrated from previous hosting provider. There are still some issues with old posts. Please make a comment on this post with any issues.

Dissecting XPS, part 2 - inside the XPS document

Tags: XML, XPS

XPS This is the second part of the Dissecting XPS series, last post generally described the XML Paper Specification. This post in the series will describe the XPS file format internals. This will give you an overview of how the XPS files are built from ground and up, instead of reading the XPS Specification which covers 453 pages.

The XPS file

The XPS file, with the .xps extension, is a ZIP file - called the physical Package, and consists of a number of XML and binary files - called Parts. There are also files describing how the files are organized and connected together - called Relationships


The parts and relationships is grouped into a Payload, according to the Open Packaging Convention[1], and an XPS document must contain at least one fixed payload, which represents a "static or fixed-layout representation of a paginated content" [2]. Each fixed payload starts with a FixedDocumentSequence, which describes the sequence of fixed documents.


The FixedDocumentSequence contains references to to the fixed documents in the XPS document. Each XPS Document must contains a specific relationship which identifies the FixedDocumentSequence that is the root of the document, called the XPS Document StartPart, so consumers of the document can find the first document sequence.

The start part relationships is stored in a .rels file in the /_rels folder and contains a reference to the the part containing the FixedDocumentSequence.

The code below shows the start part relationship file, and line 5 shows the relationship to the fixed document sequence.

   1:  <>xml version="1.0" encoding="UTF-8" standalone="yes"?>
   2:  Relationships xmlns="">
   3:  Relationship Id="rId3"          Type=""          Target="docProps/core.xml"/>
   4:  Relationship Id="rId2"          Type=""          Target="docProps/thumbnail.jpeg"/>
   5:  Relationship Id="rId1"          Type=""          Target="FixedDocSeq.fdseq"/>
   6:  Relationships>

The Type attribute on line 5 has the value of, which indicates that this is the StartPart [2: Table I-6]. Note that all targets have a paths that are relative to the parent of the _rels folder.

In the example above (taken from the XPS Specification) there are also two other relationships; line 3 tells us where to find the properties for the XPS document and line 4 shows the reference to the thumbnail image of the document, in this case a JPEG file. I will get back to these Parts later in the series.

This is the content of the FixedDocSeq.fdseq file, referenced above on line 5, in this case the XPS document has two fixed documents.

   1:  FixedDocumentSequence xmlns=""> 
   2:     DocumentReference Source="Documents/1/FixedDocument.fdoc" /> 
   3:     DocumentReference Source="Documents/2/FixedDocument.fdoc" /> 
   4:  FixedDocumentSequence> 

Line 2 and 3 contains document references to the fixed documents, their location is specified using the Source attribute and is relative to the file.

This image shows how the different parts and relationships are located in the ZIP compressed XPS document.

Brief overview of an XPS Document

The start part is found in the /_rels/.rels file, and then the document sequence can be found and then the fixed documents which contains the contents. The relationships file also points out where the thumbnail and document properties are stored.

There are also an important file called [Content_Types].xml containing the content types for the different files, located in the root. This file is specified in the Open Packaging Convention standard[2].

   1:  <>xml version="1.0" encoding="UTF-8" standalone="yes"?>
   2:  Types xmlns="">
   3:    Default Extension="rels"              ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
   4:    Default Extension="fdseq"              ContentType="application/"/>
   5:    Default Extension="fpage"              ContentType="application/"/>
   6:    Default Extension="jpg"              ContentType="image/jpeg"/>
   7:    Default Extension="fdoc"              ContentType="application/"/>
   8:  Types>

If you rename the XPS document to .ZIP you can easily look into the structure of the XPS file and find the parts and relationships.

The image above shows the root of an XPS document.

The FixedDocument Part

The FixedDocument Part is the root for all pages in the document (a set of fixed pages) and we will look into this Part and others in the next part of this Dissecting XPS series.

Further reading and references

[1] Open Packaging Convention[2] XPS Specification[3] Dissecting XPS, part 1 - The basics

No Comments

Comments have been disabled for this content.

About Wictor...

Wictor Wilén is the Nordic Digital Workplace Lead working at Avanade. Wictor has achieved the Microsoft Certified Architect (MCA) - SharePoint 2010, Microsoft Certified Solutions Master (MCSM) - SharePoint  and Microsoft Certified Master (MCM) - SharePoint 2010 certifications. He has also been awarded Microsoft Most Valuable Professional (MVP) for seven consecutive years.

And a word from our sponsors...