SPSS Viewer Format
==================

SPSS Viewer or .spv files, here called SPV files, are written by SPSS 16 and later to represent the contents of its output editor. This section documents the format.  This description is detailed enough to read SPV files, but it is probably not sufficient to write them.

An an aside, SPSS 15 and earlier versions use a completely different output format based on the Microsoft Compound Document Format.  This format is not documented.

An SPV file is a Zip archive that can be read with zipinfo and unzip and similar programs.  The final member in the Zip archive is a file named META-INF/MANIFEST.MF.  This structure makes SPV files resemble Java ``JAR'' files, but whereas a JAR manifest contains a sequence of colon-delimited key/value pairs, an SPV manifest contains the string allowPivoting=true, without a new-line.

The rest of the members in an SPV file's Zip archive fall into two categories: structure and details.  ``Structure'' member names begin with outputViewerNNNNNNNNNN, where each N is a decimal digit, and end with .xml.  Each of these members represents some kind of output item (a table, a heading, a block of text, etc.) or a group of them.  The member whose output goes at the beginning of the document is numbered 0, the next member in the output is numbered 1, and so on.

Structure members contain XML.  This XML is sometimes self-contained, but it often references other members in the Zip archive named as follows:

*_table.xml and *_tableData.bin
*_lightTableData.bin
     The structure of a table plus its data.  Older SPV files pair a *_table.xml file that describes the table's structure with a binary *_tableData.bin file that gives its data.  Newer SPV files (the majority of those in the corpus) instead include a single *_lightTableData.bin file that incorporates both into a single binary format.

*_warning.xml and *_warningData.bin
*_lightWarningData.bin
     Same format used for tables, with a different name.

*_notes.xml and *_notesData.bin
*_lightNotesData.bin
     Same format used for tables, with a different name.

*_chartData.bin and *_chart.xml
     The structure of a chart plus its data.  Charts do not have a ``light'' format.

*_model.xml
*_pmml.xml
*_stats.xml
     Not yet investigated.  The corpus contains only one example of each.

The * in the names of these members is typically an 11-digit decimal number that increases for each item, tending to skip values. Older files use different naming convention, and the exact names do not appear to matter as long as they are unique.