663097c4beff24720ce315b5bc21d29e73085d00
[pspp] / spv-file-format.texi
1 @section SPSS Viewer Format
2 @node SPSS Viewer Format
3
4 SPSS Viewer or @file{.spv} files, here called SPV files, are written
5 by SPSS 16 and later to represent the contents of its output editor.
6 This section documents the format.  This description is detailed
7 enough to read SPV files, but it is probably not sufficient to
8 write them.
9
10 An an aside, SPSS 15 and earlier versions use a completely different
11 output format based on the Microsoft Compound Document Format.  This
12 format is not documented.
13
14 An SPV file is a Zip archive that can be read with @command{zipinfo}
15 and @command{unzip} and similar programs.  The final member in the Zip
16 archive is a file named @file{META-INF/MANIFEST.MF}.  This structure
17 makes SPV files resemble Java ``JAR'' files, but whereas a JAR
18 manifest contains a sequence of colon-delimited key/value pairs, an
19 SPV manifest contains the string @samp{allowPivoting=true}, without a
20 new-line.
21
22 The rest of the members in an SPV file's Zip archive fall into two
23 categories: structure and details.  ``Structure'' member names begin
24 with @file{outputViewer@var{nnnnnnnnnn}}, where each @var{n} is a
25 decimal digit, and end with @file{.xml}.  Each of these members
26 represents some kind of output item (a table, a heading, a block of
27 text, etc.) or a group of them.  The member whose output goes at the
28 beginning of the document is numbered 0, the next member in the output
29 is numbered 1, and so on.
30
31 Structure members contain XML.  This XML is sometimes self-contained,
32 but it often references other members in the Zip archive named as
33 follows:
34
35 @table @asis
36 @item @file{*_table.xml} and @file{*_tableData.bin}
37 @itemx @file{*_lightTableData.bin}
38 The structure of a table plus its data.  Older SPV files pair a
39 @file{*_table.xml} file that describes the table's structure with a
40 binary @file{*_tableData.bin} file that gives its data.  Newer SPV
41 files (the majority of those in the corpus) instead include a single
42 @file{*_lightTableData.bin} file that incorporates both into a single
43 binary format.
44
45 @item @file{*_warning.xml} and @file{*_warningData.bin}
46 @itemx @file{*_lightWarningData.bin}
47 Same format used for tables, with a different name.
48
49 @item @file{*_notes.xml} and @file{*_notesData.bin}
50 @itemx @file{*_lightNotesData.bin}
51 Same format used for tables, with a different name.
52
53 @item @file{*_chartData.bin} and @file{*_chart.xml}
54 The structure of a chart plus its data.  Charts do not have a
55 ``light'' format.
56
57 @item *_model.xml
58 @itemx *_pmml.xml
59 @itemx *_stats.xml
60 Not yet investigated.  The corpus contains only one example of each.
61 @end table
62
63 The @file{*} in the names of these members is typically an 11-digit
64 decimal number that increases for each item, tending to skip values.
65 Older files use different naming convention, and the exact names do
66 not appear to matter as long as they are unique.