OXML Table Structure (OMS command)

OXML is XML that conforms to the spss-output schema.

  • OMS command and subtype identifiers are used as values of the command and subType attributes in OXML. For example:
    <command text="Frequencies" command="Frequencies"...>
      <pivotTable text="Gender" label="Gender" subType="Frequencies"...>

    These attribute values are not affected by output language (SET OLANG) or display settings for variable names/labels or values/value labels (SET TVARS and SET TNUMBERS).

  • XML is case-sensitive. The element name pivotTable is considered a different element from one named "pivottable" or "Pivottable" (the latter two don't exist in OXML).
  • Command and subtype identifiers generated by the OMS Control Panel or the OMS Identifiers dialog box (both on the Utilities menu) use the same case as that used for values of the command and subType OXML attributes.
  • All of the information 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 that 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, but not necessarily the parent/child relationships, because there are typically intervening nested element levels. The following figures show a simple table as displayed in the Viewer and the OXML that represents that table.

Figure 1. Simple frequency table
Simple frequency table
Figure 2. OXML for simple frequency table

<?xml version="1.0" encoding="UTF-8" ?> 
<outputTree>
 <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 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. For example:
    <command text="Frequencies" command="Frequencies"...> 

    These text attributes can be affected by both output language (SET OLANG) and settings that affect the display of variable names/labels and values/value labels (SET TVARS and SET TNUMBERS). 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. For example:
    <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 a string attribute. The label attribute is present only if the variable or values have defined labels.

  • The <cell> elements that contain cell values for numbers will contain the text attribute and one or more additional attribute values. For example:
    <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 displayed in the table.

  • Since columns are nested within rows, the category element that identifies each column is repeated for each row. For example, since 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.

Examples of using XSLT to transform OXML are provided in the Help system.