OXML table structure
Output XML (OXML) is XML that conforms to the spss-output schema. See the topic Output XML Schema for more information.
- OMS command and subtype identifiers are used as values
of the
command
andsubType
attributes in OXML. An example is as follows:<command text="Frequencies" command="Frequencies"...> <pivotTable text="Gender" label="Gender" subType="Frequencies"...>
- OMS
command
andsubType
attribute values are not affected by output language or display settings for variable names/labels or values/value labels. - XML is case sensitive. A
subType
attribute value of "frequencies" is not the same as asubType
attribute value of "Frequencies." - All information that is displayed in a table is contained in attribute values in OXML. At the individual cell level, OXML consists of “empty” elements that contain attributes but no “content” other than the content that is contained in attribute values.
- Table structure in OXML is represented row by row; elements that represent columns are nested within the rows, and individual cells are nested within the column elements:
<pivotTable...>
<dimension axis='row'...>
<dimension axis='column'...>
<category...>
<cell text=’...' number='...' decimals='...'/>
</category>
<category...>
<cell text='...' number='...' decimals='...'/>
</category>
</dimension>
</dimension>
...
</pivotTable>
The preceding example is a simplified representation of the structure that shows the descendant/ancestor relationships of these elements. However, the example does not necessarily show the parent/child relationships, because there are typically intervening nested element levels.
The following example shows a simple frequency table and the complete output XML representation of that table.
Gender | Frequency | Percent | Valid Percent | Cumulative Percent | |
---|---|---|---|---|---|
Valid | Female | 216 | 45.6 | 45.6 | 45.6 |
Male | 258 | 54.4 | 54.4 | 100.0 | |
Total | 474 | 100.0 | 100.0 |
<?xml version="1.0" encoding="UTF-8" ?>
<outputTreeoutputTree xmlns="http://xml.spss.com/spss/oms"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xml.spss.com/spss/oms
http://xml.spss.com/spss/oms/spss-output-1.0.xsd">
<command text="Frequencies" command="Frequencies"
displayTableValues="label" displayOutlineValues="label"
displayTableVariables="label" displayOutlineVariables="label">
<pivotTable text="Gender" label="Gender" subType="Frequencies"
varName="gender" variable="true">
<dimension axis="row" text="Gender" label="Gender"
varName="gender" variable="true">
<group text="Valid">
<group hide="true" text="Dummy">
<category text="Female" label="Female" string="f"
varName="gender">
<dimension axis="column" text="Statistics">
<category text="Frequency">
<cell text="216" number="216"/>
</category>
<category text="Percent">
<cell text="45.6" number="45.569620253165" decimals="1"/>
</category>
<category text="Valid Percent">
<cell text="45.6" number="45.569620253165" decimals="1"/>
</category>
<category text="Cumulative Percent">
<cell text="45.6" number="45.569620253165" decimals="1"/>
</category>
</dimension>
</category>
<category text="Male" label="Male" string="m" varName="gender">
<dimension axis="column" text="Statistics">
<category text="Frequency">
<cell text="258" number="258"/>
</category>
<category text="Percent">
<cell text="54.4" number="54.430379746835" decimals="1"/>
</category>
<category text="Valid Percent">
<cell text="54.4" number="54.430379746835" decimals="1"/>
</category>
<category text="Cumulative Percent">
<cell text="100.0" number="100" decimals="1"/>
</category>
</dimension>
</category>
</group>
<category text="Total">
<dimension axis="column" text="Statistics">
<category text="Frequency">
<cell text="474" number="474"/>
</category>
<category text="Percent">
<cell text="100.0" number="100" decimals="1"/>
</category>
<category text="Valid Percent">
<cell text="100.0" number="100" decimals="1"/>
</category>
</dimension>
</category>
</group>
</dimension>
</pivotTable>
</command>
</outputTree>
As you may notice, a simple, small table produces a substantial amount of XML. That's partly because the XML contains some information that is not readily apparent in the original table, some information that might not even be available in the original table, and a certain amount of redundancy.
- The table contents as they are (or would be) displayed
in a pivot table in the Viewer are contained in text attributes. An
example is as follows:
<command text="Frequencies" command="Frequencies"...>
- Text attributes can be affected by both output language
and settings that affect the display of variable names/labels and
values/value labels. In this example, the
text
attribute value will differ, depending on the output language, whereas the command attribute value remains the same, regardless of output language. - Wherever variables or values of variables are used
in row or column labels, the XML will contain a
text
attribute and one or more additional attribute values. An example is as follows:<dimension axis="row" text="Gender" label="Gender" varName="gender"> ...<category text="Female" label="Female" string="f" varName="gender">
- For a numeric variable, there would be a
number
attribute instead of astring
attribute. Thelabel
attribute is present only if the variable or values have defined labels. - The
<cell>
elements that contain cell values for numbers will contain thetext
attribute and one or more additional attribute values. An example is as follows:
<cell text="45.6" number="45.569620253165" decimals="1"/>
The number
attribute is the actual, unrounded numeric value, and the decimals
attribute indicates the number of
decimal positions that are displayed in the table.
- Because columns are nested within rows, the category
element that identifies each column is repeated for each row. For
example, because the statistics are displayed in the columns, the
element
<category text="Frequency">
appears three times in the XML: once for the male row, once for the female row, and once for the total row.