isXPS Conformance Tool

The isXPS Conformance tool (isXPS.exe) tests a file's conformity to the XML Paper Specification (XPS) and the Open Packaging Conventions (OPC) Specification.

You can download the XPS and the OPC specifications at XPS: Specification and License Downloads.

Features

  • Generates a detailed report of the tests it performs.

  • Can test multiple files in a batch job.

  • Provides a description of every failure in every file tested.

  • Intelligently suggests which rules may have been violated by each failure found.

  • Supports switches that enable custom testing; for example, testing only for OPC conformity.

Syntax

isXPS /f=file_name_or_pattern [options]

Note

You can use a hyphen ("-") in place of the forward slash ("/") and a colon (":") in place of the equal sign ("=") in all switches.

Switches

Switch

Description

/?

Help for the tool is displayed in the cmd.exe window. This switch blocks all tests from running. (The switch will also cause the tool to report a failure. This is to insure that there are no accidental "pass" reports when the test is run in the testing infrastructure of the Windows Driver Kit.)

/BadDir=path

Specifies a directory where files that fail the conformity test will be copied or moved. They will be moved if the /DelBad switch is used. They will be copied, if it is not used.

/DelBad

Specifies that files that fail the conformity test will be deleted from their current directory. (When used with the /BadDir switch, the files are moved to the directory specified by the latter switch. If the /BadDir switch is not used, they are deleted.)

/device="device_string"

Specifies a custom device string that is used with the Windows Test Technologies (WTT) logger, which is available with the Windows Driver Kit. (See /logger.)

/doc=Doc_XSD_file

Specifies a custom XML Schema Definition (XSD) file for the validation of the <DocumentStructure> parts of the XPS file. We recommend that you let the tool use its built-in default XSD file instead of a custom file.

/f

Mandatory. Specifies the file or files to test. The standard command line wildcard characters, "?" and "*", can be used in file_name_or_pattern. If there are any spaces in the path or file name, enclose the whole path or file name in quotation marks. The file name extension for XPS files is usually 'xps' but it does not have to be.

/logfile=file_name

Specifies the path and file name for the log file. This switch is ignored unless the /logger switch is set to File. If the /logfile switch is not used and the /logger switch is set to File, the log file is isXPSLog.txt in the current directory. If the /logsplit switch is used with a value larger than 0, then the log file that is specified with /logfile will contain only the Setup test. The other tests will be in one or more other log files. See /logprefix and /logsplit later in this table for more information, and see later in this topic for a description of all tests.

/logger=log_type

Specifies what kind of output to generate. This can be any of these values:

  • Console (default) - Output is streamed to the cmd.exe window.

  • File - Output is saved to a text file that is named isXPSLog.txt in the current directory, unless another path or file name is specified with the /logfile switch.

  • WTT - Output is saved to a Windows Test Technologies log file that is named isXPSLog.wtl in the current directory. This option is useable only when the test is run in the testing infrastructure of the Windows Driver Kit.

/logprefix=prefix

Specifies a prefix that will be added to the start of the file names of the log files that are produced when the /logsplit switch is used.

When this switch is used without an explicit /logsplit switch (or with an explicit /logsplit=0), then the tool behaves as if /logsplit=1 (see /logsplit later in this table).

/logsplit=number

Specifies whether, and how, the log is split into the multiple files.

When this switch is absent, or is present but set to its default of 0, there is no splitting (unless /logprefix is used anyway, in which case there is splitting and the tool behaves as if /logsplit=1 even when there is an explicit /logsplit=0 switch).

When this switch is set to 1, only the Setup test will be reported in the file isXPSlog.txt (or whatever file is specified with the /logfile switch). Each file test (see "II. The <file_name> test" later in this topic) will be reported in a separate log file that is named _file_name.log where file_name is the name of the XPS file being tested. There will be a prefix before the underscore if the /logprefix parameter is used.

When this switch is set to any value larger than 1, it indicates how many file tests are included in each log file. Only the Setup test will be reported in the file isXPSlog.txt (or whatever file is specified with the /logfile switch). The other tests will be reported in separate log files that are named _NtoM.log, where NtoM specifies the range of files included in the log file. For example, if five files match the pattern specified with the /f parameter and /logsplit is set to 2, the tool will generate files named _1to2.log, _3to4.log, and _5to5.log. There will be a prefix before the underscore if the /logprefix parameter is used.

This switch is ignored unless the /logger switch is set to File. See later in this topic for a description of all tests.

/NoInterleave

This switch blocks the Interleave test. See later in this topic for a description of all tests.

/OnlyOPC

Specifies that the input file is to be tested only for OPC conformity, not also XPS conformity. The internal markup of OPC -specific parts is tested. This switch blocks the XPS Package Structure test from running. See later in this topic for a description of all tests.

/OnlyPkg

Specifies that the parts of the file are tested only to make sure that they are stored in the package correctly, have the correct type of content, and the correct relationships between them. The internal markup of the parts, including the OPC specific parts, is not tested. This switch blocks the Relationships Markup test part of the OPC Validation test from running. It also blocks the Fixed Document Sequence test, Fixed Document test, or Fixed Page test parts of the XPS Package Structure test from running. Finally, it blocks the Validation of Independent Resources tests from running. See later in this topic for a description of all tests.

/r=Rsc_XSD_file

Specifies a custom XML Schema Definition (XSD) file for the validation of the <ResourceDictionary> parts of the XPS file. We recommend that you let the tool use its built-in default XSD file instead of a custom file.

/s

Specifies that subdirectories will be included in the search for files that match the pattern that is specified with the /f switch. If this switch is not used, subdirectories are not included. The parent directory is the current directory unless a different one is specified with the /f switch.

/SkipResParts

Specifies that independent resources (fonts and images) are not tested. This switch blocks the Validation of Independent Resources tests from running. See later in this topic for a description of all tests.

/x=S0_XSD_file

Specifies a custom XML Schema Definition (XSD) file for the validation of the <FixedDocumentSequence>, <FixedDocument>, and <FixedPage> parts of the XPS file. We recommend that you let the tool use its built-in default XSD file instead of a custom file.

Log File Interpretation

The output is a series of nested test results. The start of each test is marked by a "+Start Test" line and the end of each test is marked by a "-End Test" line. The root test is the whole set of tests for all the files specified with the /f switch. For example, if the /f switch specifies "s*.xps", the root test is shown in the following example.

Beginning Test ******************************************
+Start Test: isXPS s*.xps

       … matter omitted … 

-End Test: isXPS s*.xps Result: Fail

Log Rollup***************************** TestName: isXPS s*.xps PassRate: 77% Pass: 63 Warn: 0 Fail: 18 Block: 0 ******************************************************* Result: Fail

Notice that the "-End Test" line gives the overall result. If any file fails, the test as whole is marked "Fail".

The "Log Rollup" section summarizes the whole test. The "PassRate" is the percentage of tests that passed. "Pass", "Warning", and "Fail", give the number of tests that passed, passed-with-a-warning, and failed, respectively. ("Block" is a special failure state that is not used with the current version of the tool.)

The overall result is repeated in the last line.

There are two kinds of child tests of the root test:

  • Setup - There is exactly one Setup test in each log.

  • <file_name> - There is a test for each file that matches the pattern specified with the /f switch.

Setup Test

The Setup test is used to determine whether the tool can run, parse its command line, and load and compile the XSD files. It has five kinds of child tests:

  1. Logger initialization - There is exactly one of these. It is always logged as "Pass" because if it fails, the log will not be generated anyway.

  2. Command line parsing - There is exactly one of these. If it fails, no details are reported, but help about the tool's syntax is streamed to the console.

  3. Loading and registering of custom XSD files - There will be from zero to three such child tests; one for each of the following switches that is used: /doc, /r, and /x. After an XSD file loads, the tool will register it. If the namespace associated with the XSD applies to more than one part of the XPS markup, then it will be registered separately for each part to which it applies. For example, the <DocumentStructure> XSD will be registered for both the <DocumentStructure> and the <StoryFragments> parts. See the example below.

    Note

    If a custom XSD file cannot load, the tool will not load any remaining XSDs. These include all the built-in XSDs. As a result, most subsequent tests will not run.

  4. Loading and registering of the built-in XSD files - Unless a custom XSD cannot load, there will be at least nine of these tests. There will be one additional such test for each of the /doc, /r, and /x switches that is not used. The points made in the previous bullet about registration of custom XSDs apply to the built-in XSDs also.

  5. XSD Compilation - Assuming all the XSD files loaded, there is one compilation test and it will fail if any one of the XSD files cannot compile. If any XSD file cannot load, this test is not run.  

The following is an example of the outcome of a Setup test. In this example, the /x switch was used to specify an alternative S0 schema.

+Start Test: Setup
  Pass: Logger Initialized successfully
  Pass: Command line parameters parsed successfully
  Info: Reading stream for S0 schema from .\alternatexsds\s0schema.xsd
  Info: Registering Schema for namespace https://schemas.microsoft.com/xps/2005/06 
    and ContentType application/vnd.ms-package.xps-fixedpage+xml from provided stream
  Info: Registering Schema for namespace https://schemas.microsoft.com/xps/2005/06 
    and ContentType application/vnd.ms-package.xps-fixeddocument+xml from provided stream
  Info: Registering Schema for namespace https://schemas.microsoft.com/xps/2005/06 
    and ContentType application/vnd.ms-package.xps-fixeddocumentsequence+xml from provided stream
  Info: Registering Schema for namespace https://schemas.microsoft.com/xps/2005/06 
    and ContentType application/vnd.ms-package.xps-resourcedictionary+xml from provided stream
  Info: No filename specified for Resource Dictionary Key schema. Using default
  Info: No filename specified for Document Structure schema. Using default
  Info: Loading default Schema for Resource Dictionary key. (rdkey.xsd)
  Info: Registering Schema for namespace https://schemas.microsoft.com/xps/2005/06/resourcedictionary-key 
    and ContentType application/vnd.ms-package.xps-fixedpage+xml from provided stream
  Info: Registering Schema for namespace https://schemas.microsoft.com/xps/2005/06/resourcedictionary-key 
    and ContentType application/vnd.ms-package.xps-fixeddocument+xml from provided stream
  Info: Registering Schema for namespace https://schemas.microsoft.com/xps/2005/06/resourcedictionary-key 
    and ContentType application/vnd.ms-package.xps-fixeddocumentsequence+xml from provided stream
  Info: Registering Schema for namespace https://schemas.microsoft.com/xps/2005/06/resourcedictionary-key 
    and ContentType application/vnd.ms-package.xps-resourcedictionary+xml from provided stream
  Info: Loading default Schema for Document structure (DocStructure.xsd)
  Info: Registering Schema for namespace https://schemas.microsoft.com/xps/2005/06/documentstructure 
    and ContentType application/vnd.ms-package.xps-documentstructure+xml from provided stream
  Info: Registering Schema for namespace https://schemas.microsoft.com/xps/2005/06/documentstructure 
    and ContentType application/vnd.ms-package.xps-storyfragments+xml from provided stream
  Info: Loading default Schema for Relationship markup (Relationships.xsd)
  Info: Registering Schema for namespace https://schemas.openxmlformats.org/package/2006/relationships 
    and ContentType application/vnd.openxmlformats-package.relationships+xml from provided stream
  Info: Loading default Schema for Package properties (CoreProperties.xsd)
  Info: Registering Schema for namespace https://schemas.openxmlformats.org/package/2006/metadata/core-properties 
    and ContentType application/vnd.openxmlformats-package.core-properties+xml from provided stream
  Info: Loading default Dublin Schema for Package properties (dc.xsd)
  Info: Registering Schema for namespace http://purl.org/dc/elements/1.1/ 
    and ContentType application/vnd.openxmlformats-package.core-properties+xml 
    from provided stream
  Info: Loading default Dublin terms Schema for Package properties (dcterms.xsd)
  Info: Registering Schema for namespace http://purl.org/dc/terms/ 
    and ContentType application/vnd.openxmlformats-package.core-properties+xml 
    from provided stream
  Info: Loading default Dublin type Schema for Package properties (dcmitype.xsd)
  Info: Registering Schema for namespace http://purl.org/dc/dcmitype/ 
    and ContentType application/vnd.openxmlformats-package.core-properties+xml 
    from provided stream
  Info: Loading the OPC Digital Signature Schema (OPC_DigSig.xsd)
  Info: Registering Schema for namespace https://schemas.openxmlformats.org/package/2006/digital-signature 
    and ContentType application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml 
    from provided stream
  Info: Loading the XML Digital Signature Core Schema (xmldsig-core-schema.xsd)
  Info: Registering Schema for namespace http://www.w3.org/2000/09/xmldsig# 
    and ContentType application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml 
    from provided stream
  Info: Loading default Schema for Digital Signature Definitions (SignatureDefinitions.xsd)
  Info: Registering Schema for namespace https://schemas.microsoft.com/xps/2005/06/signature-definitions 
    and ContentType CustomSignatureDefinitionTag from provided stream
  Info: Loading default Schema for the Discard Control part (DiscardControl.xsd)
  Info: Registering Schema for namespace https://schemas.microsoft.com/xps/2005/06/discard-control 
    and ContentType application/vnd.ms-package.xps-discard-control+xml from provided stream
  Info: Compiling schemas
-End Test: Setup Result: Pass

For information about the Dublin schemas referred to in the example, see The Dublin Core Metadata Initiative.

<file_name> Test

Each test of a particular file consists of the following child tests:

  • Interleave test.

  • Validation of independent resources test.

  • OPC validation test.

  • XPS package structure test.

Interleave Test

The tool reports whether the file is interleaved or not, and if the file is interleaved, whether it is interleaved correctly. (This test does not run if the /NoInterleave switch is used.) There are two child tests:

  1. Collection of Pieces Test - The tool collects all the embedded pieces of the file. These include each font and image file, the relationship files, and each *.fpage, *.fdoc, *.fdseq, and *.frag file. Below is an example of the log entry for this test. The XPS package being tested has a single fixed document that has a single fixed page, a single font, and a single image.

    +Start Test: Collecting pieces from .\MyFile.xps
      Info: _rels/.rels, collected
      Info: Documents/FixedDocument_1.fdoc, collected
      Info: Pages/_rels/FixedPage_1.fpage.rels, collected
      Info: Pages/FixedPage_1.fpage, collected
      Info: Resources/Fonts/33c063c8-1259-4322-acc8-8fc1964cc064.ODTTF, collected
      Info: Resources/Images/Image_1.png, collected
      Info: [Content_Types].xml, collected
      Info: FixedDocumentSequence.fdseq, collected
    -End Test: Collecting pieces from .\MyFile.xps Result: Pass
    
  2. Ordering of Parts Test - This test determines whether the order of the parts of the file is the same in the Zip central directory as it is in the Zip local file header. If the order is different the test gives you a "Warn", because the Microsoft Windows XP shell does not allow for editing of zip files in which the order is different. 

Validation of Independent Resources Tests

The Validation of Independent Resources tests search the entire file for XPS parts that point to font or image content types and the tests verify that each resource is of the correct content type. For example, it verifies that the resource pointed to by a font content type really is a font. (These tests do not run if the /SkipResParts switch or the /OnlyPkg switch is used.)

OPC Validation Test

The OPC Validation test checks the XPS file's conformity to the OPC specification.

The test has two children:

  1. Relationships Markup Test - The tool validates every <Relationships> part in the package, except relationships from the package root. There is a child test for every such part. For example, suppose there is a <Relationships> part called 1.fpage.rels as follows.

    <?xml version="1.0" encoding="utf-8"?>
    <Relationships xmlns="https://schemas.openxmlformats.org/package/2006/relationships">
      <Relationship 
        Type="https://schemas.microsoft.com/xps/2005/06/required-resource" 
        Target="../../../Resources/7c1549d5-8780-4db6-8831-19bfe6d8f88d.ttf" 
        Id="Rf50d8565978247c5" />
      <Relationship 
        Type="https://schemas.microsoft.com/xps/2005/06/required-resource" 
        Target="../../../Resources/2884eaa8-9d38-4506-adf8-977a24ff9faa.jpg" 
        Id="R3643335530274b5f" />
    </Relationships>
    

    The tool would return the following log entry.

    +Start Test: /Documents/1/Pages/_rels/1.fpage.rels Markup
      Info: Validating Markup of Part /Documents/1/Pages/_rels/1.fpage.rels 
        using target namespace "https://schemas.openxmlformats.org/package/2006/relationships"
      Pass: Markup of Part is Compliant according to the XSD supplied
    -End Test: /Documents/1/Pages/_rels/1.fpage.rels Markup Result: Pass
    

    If the /OnlyPkg switch is used, the log entries for the Relationships Markup test will just warn that no validation was done.

  2. Package Relationships Markup Test - The tool validates the <Relationships> part, if any, at the root of the XML Paper Specification (XPS) package. For example, suppose there is a <Relationships> part called .rels as follows.

    <?xml version="1.0" encoding="utf-8"?>
    <Relationships xmlns="https://schemas.openxmlformats.org/package/2006/relationships">
      <Relationship Type="https://schemas.microsoft.com/xps/2005/06/fixedrepresentation"
        Target="/FixedDocumentSequence.fdseq" Id="Ra1bd31ccb7f04267" />
      <Relationship 
        Type="https://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin"
        Target="/package/services/digital-signature/origin.psdsor" Id="R290472945f4248d7" />
    </Relationships>
    

    The tool would return the following log entry.

    Info: Found a https://schemas.microsoft.com/xps/2005/06/fixedrepresentation 
      relationship, validating...
    Pass: Valid Relationship to /FixedDocumentSequence.fdseq from a PackageRoot part. 
      RelationshipType: https://schemas.microsoft.com/xps/2005/06/fixedrepresentation
    Info: Found a https://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin
      relationship, validating...
    Info: Digital Signature Origin part /package/services/digital-signature/origin.psdsor 
      found, validating...
    
        … matter omitted … 
    
    Pass: Valid Relationship to /package/services/digital-signature/origin.psdsor 
      from a PackageRoot part. RelationshipType: 
      https://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin
    

    If the relationship from the root is to an object that has internal markup, such as a <DigitalSignature> part, the validation of that <Relationship> part would include, as a child test, a validation of the target's markup. And the latter test could have its own children. For example, in the previous example, the test of the "Digital Signature Origin part" actually had the following test tree entry in place of "… matter omitted …".

    +Start Test: Digital Signature Valdiation
      Info: Found a https://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature 
        relationship, validating...
      Info: Found Digital Signature part 
        /package/services/digital-signature/xml-signature/c613c04b58cb4d619c92bab230c4b0c6.psdsxs, 
        validating...
      +Start Test: /package/services/digital-signature/xml-signature/c613c04b58cb4d619c92bab230c4b0c6.psdsxs Markup
        Info: Validating Markup of Part 
          /package/services/digital-signature/xml-signature/c613c04b58cb4d619c92bab230c4b0c6.psdsxs 
          using target namespace "http://www.w3.org/2000/09/xmldsig#"
        Pass: Markup of Part is Compliant according to the XSD supplied
      -End Test: /package/services/digital-signature/xml-signature/c613c04b58cb4d619c92bab230c4b0c6.psdsxs 
        Markup Result: Pass
      Info: Found a https://schemas.openxmlformats.org/package/2006/relationships/digital-signature/certificate
        relationship, validating...
      Pass: Valid Relationship to 
        /package/services/digital-signature/certificate/715364A10002007DBA0C.cer from a
        application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml part. 
        RelationshipType: https://schemas.openxmlformats.org/package/2006/relationships/digital-signature/certificate
      Pass: Valid Relationship to 
        /package/services/digital-signature/xml-signature/c613c04b58cb4d619c92bab230c4b0c6.psdsxs from a 
        application/vnd.openxmlformats-package.digital-signature-origin part. 
        RelationshipType: https://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature
    -End Test: Digital Signature Valdiation Result: Pass
    

XPS Package Structure Test

The XPS Package Structure test walks recursively through the tree of the XPS package. As it does so, it validates the markup of each part and verifies that there is a <Relationship> part for every resource that is referenced in the markup. (This test does not run if the /OnlyOPC is used.)

The following child tests are included.

  1. Fixed Document Sequence Test - The <FixedDocumentSequence> markup in the *.fdseq file is validated. The following example shows the log report when the test is passed.

    +Start Test: /FixedDocumentSequence.fdseq Markup
      Info: Validating Markup of Part /FixedDocumentSequence.fdseq using 
        target namespace "https://schemas.microsoft.com/xps/2005/06"
      Pass: Markup of Part is Compliant according to the XSD supplied
    -End Test: /FixedDocumentSequence.fdseq Markup Result: Pass
    

    The following is example shows the log report when the test fails, in this case because the XPS producer mistakenly added text between the <FixedDocumentSequence> begin and end tags.

    +Start Test: /FixedDocumentSequence.fdseq Markup
      Info: Validating Markup of Part /FixedDocumentSequence.fdseq using 
        target namespace https://schemas.microsoft.com/xps/2005/06
      Fail: Markup is not Compliant:  Number of errors: 1
      Info: XPSRule: M2.72
      Info: Error #1: At position (1,134) Message: The element 'FixedDocumentSequence' 
        in namespace 'https://schemas.microsoft.com/xps/2005/06' 
        cannot contain text. List of possible elements expected: 
        'DocumentReference' in namespace 'https://schemas.microsoft.com/xps/2005/06'.
    -End Test: /FixedDocumentSequence.fdseq Markup Result: Fail
    

    If the /OnlyPkg switch is used, the log entries for the Fixed Document Sequence test will just warn that no validation was done.

  2. Fixed Document Test - The <FixedDocument> markup in a *.fdoc file is validated. The following example shows the log report when the test is passed.

    +Start Test: /Documents/FixedDocument_1.fdoc Markup
      Info: Validating Markup of Part /Documents/FixedDocument_1.fdoc 
        using target namespace "https://schemas.microsoft.com/xps/2005/06"
      Pass: Markup of Part is Compliant according to the XSD supplied
    -End Test: /Documents/FixedDocument_1.fdoc Markup Result: Pass
    

    The following is example shows the log report when the test fails, in this case because the <FixedDocument> part contains a reference to a page (<PageContent Source="../Pages/FixedPage_3.fpage" />) that is not in the package. Notice that the log provides a list of rules that may have been violated. You can look up errors in the XPS specifications, which are available for download at XPS: Specification and License Downloads.

    Fail: Error getting part: /Pages/FixedPage_3.fpage Message: 
      Specified part does not exist in the package.
    Fail: Reference to non-existant or corrupted part: 
      /Pages/FixedPage_3.fpage from /Documents/FixedDocument_1.fdoc
    Info: Possible violation of OPC rules M1.1, M1.2, M1.5, M1.6, M1.7,
      M1.8, M1.10, MB.2 
    

    If the /OnlyPkg switch is used, the log entries for the Fixed Document test will just warn that no validation was done.

  3. Fixed Page Test - The <FixedPage> markup in a *.fpage file is validated. The following example shows the log report when the test is passed.

    +Start Test: /Pages/FixedPage_1.fpage Markup
      Info: Validating Markup of Part /Pages/FixedPage_1.fpage using 
        target namespace "https://schemas.microsoft.com/xps/2005/06"
      Pass: Markup of Part is Compliant according to the XSD supplied
    -End Test: /Pages/FixedPage_1.fpage Markup Result: Pass
    

    The following is example shows the log report when the test fails, in this case because the <FixedPage> part contains an attribute that is not declared in the XPS schema. The log identifies the rule that is violated, and it specifies the exact character position where the erroneous markup starts.

    +Start Test: /Pages/FixedPage_2.fpage Markup
      Info: Validating Markup of Part /Pages/FixedPage_2.fpage using 
        target namespace "https://schemas.microsoft.com/xps/2005/06"
      Fail: Markup is not Compliant:  Number of errors: 1
      Info: XPSRule: M2.72
      Info: Error #1: At position (4,55) Message: The 'Stretch' 
        attribute is not declared.
    -End Test: /Pages/FixedPage_2.fpage Markup Result: Fail 
    

    If the /OnlyPkg switch is used, the log entries for the Fixed Page test will just warn that no validation was done.

  4. Custom Markup Test - This tests for conformity to rules that are not imposed by the XSD files themselves, such as M2.74, M3.7 through M3.14, and M4.3. You can find these rules in the XPS specifications, which are available for download at XPS: Specification and License Downloads.

  5. Page Relationships Test - This test checks every reference to a resource part (a font, image, remote resource dictionary, or International Color Consortium [ICC] profile) in the <FixedPage> markup (the page_name.fpage component of an XPS package) and verifies that there is a corresponding required-resource relationship to that resource (in the page_name.fpage.rels component) and that the relationship points to the correct type of part. There is a child test for each resource. The following example shows a log entry for a relationship to a font.

    +Start Test: /Documents/1/Pages/3.fpage Relationships
      Info: Validating Relationships of Part /Documents/1/Pages/3.fpage
      Info: Validating Font part: /Resources/86e01f8d-dfc9-438e-9d02-830e7076a3f8.ODTTF 
        ContentType: application/vnd.ms-package.obfuscated-opentype
      Info: Name:Verdana, Embedding rights:Installable, Glyphs count:62
      Pass: Found relationship to resource Part: 
        /Resources/86e01f8d-dfc9-438e-9d02-830e7076a3f8.ODTTF
    -End Test: /Documents/1/Pages/3.fpage Relationships Result: Pass
    
  6. Unreferenced Parts Test - If any unreferenced parts are found in the package, the log will show a warning.

The order of the child tests in the XPS Package Structure test is as follows.

  1. Test the <FixedDocumentSequence> part.

  2. Test the first (or next) <FixedDocument> part referred to in the <FixedDocumentSequence> part.

  3. Test the first (or next) <FixedPage> part referred to in the <FixedDocument> part.

  4. Test the custom markup, if any, in the <FixedPage> part.

  5. Test the <Relationships> part, if any, of the <FixedPage> part. This test has the following child tests.

    1. Test the first (or next) <Relationship> part in the <Relationships> part. Relationships can be to fonts, images, remote resource dictionaries, and International Color Consortium (ICC) profiles.

    2. Repeat step a for every relationship.

  6. Repeat steps 3 through 5 for every page in the document.

  7. Repeat steps 2 through 6 for every document in the sequence.

  8. Test for unreferenced parts.

The following example shows a complete XPS Package Structure test result for a package with one (two-page) document, one font on each page, and an image on the second page. Notice that on the second page of the second document, the <FixedPage> part has a reference to a "Stretch" attribute that is not declared in the XPS specification. For this reason, the tool fails this page and the package.

+Start Test: Validating XPS Package structure: .\Spec.xps
  Info: Validating XPSRule M2.14
  Info: Found a https://schemas.microsoft.com/xps/2005/06/fixedrepresentation 
    relationship, validating...
  Pass: Valid Relationship to /FixedDocumentSequence.fdseq 
    from a PackageRoot part. RelationshipType: 
    https://schemas.microsoft.com/xps/2005/06/fixedrepresentation
  Pass: Found a Valid StartPart with ContentType: 
    application/vnd.ms-package.xps-fixeddocumentsequence+xml
  +Start Test: /FixedDocumentSequence.fdseq Markup
    Info: Validating Markup of Part /FixedDocumentSequence.fdseq using 
      target namespace "https://schemas.microsoft.com/xps/2005/06"
    Pass: Markup of Part is Compliant according to the XSD supplied
  -End Test: /FixedDocumentSequence.fdseq Markup Result: Pass
  Pass: Found markup reference to Valid Part with expected ContentType. 
    TargetURI: /Documents/FixedDocument_1.fdoc ContentType: 
    application/vnd.ms-package.xps-fixeddocument+xml
  +Start Test: /Documents/FixedDocument_1.fdoc Markup
    Info: Validating Markup of Part /Documents/FixedDocument_1.fdoc 
      using target namespace "https://schemas.microsoft.com/xps/2005/06"
    Pass: Markup of Part is Compliant according to the XSD supplied
  -End Test: /Documents/FixedDocument_1.fdoc Markup Result: Pass
  Pass: Found markup reference to Valid Part with expected ContentType. 
    TargetURI: /Pages/FixedPage_1.fpage ContentType: 
    application/vnd.ms-package.xps-fixedpage+xml
  +Start Test: /Pages/FixedPage_1.fpage Markup
    Info: Validating Markup of Part /Pages/FixedPage_1.fpage using 
      target namespace "https://schemas.microsoft.com/xps/2005/06"
    Pass: Markup of Part is Compliant according to the XSD supplied
  -End Test: /Pages/FixedPage_1.fpage Markup Result: Pass
  +Start Test: /Pages/FixedPage_1.fpage Custom Markup validation
  -End Test: /Pages/FixedPage_1.fpage Custom Markup validation Result: Pass
  +Start Test: /Pages/FixedPage_1.fpage Relationships
    Info: Validating Relationships of Part /Pages/FixedPage_1.fpage
    Info: Validating Font part: 
      /Resources/Fonts/9aa4ea89-755c-4331-be84-0cd43ff87195.ODTTF 
      ContentType: application/vnd.ms-package.obfuscated-opentype
    Info: Name:Verdana, Embedding rights:Installable, Glyphs count:35
    Pass: Found relationship to resource Part: 
      /Resources/Fonts/9aa4ea89-755c-4331-be84-0cd43ff87195.ODTTF
  -End Test: /Pages/FixedPage_1.fpage Relationships Result: Pass
  Pass: Found markup reference to Valid Part with expected ContentType. 
    TargetURI: /Pages/FixedPage_2.fpage 
    ContentType: application/vnd.ms-package.xps-fixedpage+xml
  +Start Test: /Pages/FixedPage_2.fpage Markup
    Info: Validating Markup of Part /Pages/FixedPage_2.fpage using 
      target namespace "https://schemas.microsoft.com/xps/2005/06"
    Fail: Markup is not Compliant:  Number of errors: 1
    Info: XPSRule: M2.72
    Info: Error #1: At position (4,55) Message: The 'Stretch' attribute 
      is not declared.
  -End Test: /Pages/FixedPage_2.fpage Markup Result: Fail
  +Start Test: /Pages/FixedPage_2.fpage Custom Markup validation
  -End Test: /Pages/FixedPage_2.fpage Custom Markup validation Result: Pass
  +Start Test: /Pages/FixedPage_2.fpage Relationships
    Info: Validating Relationships of Part /Pages/FixedPage_2.fpage
    Pass: Found relationship to resource Part: /Resources/Images/Image_1.png
    Info: Validating Font part: 
      /Resources/Fonts/3b85141b-0969-4d9e-b9c8-e705bb7e6543.ODTTF 
      ContentType: application/vnd.ms-package.obfuscated-opentype
    Info: Name:Times New Roman, Embedding rights:Installable, Glyphs count:4
    Pass: Found relationship to resource Part: 
      /Resources/Fonts/3b85141b-0969-4d9e-b9c8-e705bb7e6543.ODTTF
  -End Test: /Pages/FixedPage_2.fpage Relationships Result: Pass
  Pass: No un-referenced parts found
-End Test: Validating XPS Package structure: .\Spec.xps Result: Fail

Requirements

.NET Framework 3.0

See Also

Other Resources

XPS: Specification and License Downloads

XPS and Windows Vista

XPS Documents: A First Look at APIs For Creating XML Paper Specification Documents

Programming XPS Documents Lab and Extending the XPS Document Viewing Experience Lab