OXML 表结构

输出 XML (OXML) 是符合 spss 输出架构的 XML。请参阅 输出 XML 架构 主题以获取更多信息。

  • OMS 命令和子类型标识用作 OXML 中的 commandsubType 属性的值。示例如下:
    <command text="Frequencies" command="Frequencies"...>   <pivotTable text="Gender" label="Gender" subType="Frequencies"...>
  • OMS commandsubType 属性值不受输出语言或变量名称/标签或值/值标签的显示设置的影响。
  • XML 区分大小写。“frequencies”的 subType 属性值与“Frequencies”的 subType 属性值相同。
  • 显示在表中的所有信息都包含在 OXML 的属性值中。在各个单元格级别,OXML 由“空”元素组成,这些元素包含属性,但不包含属性值中包含的内容以外的“内容”。
  • OXML 中的表结构逐行表示;表示列的元素嵌套在行中,单个单元格嵌套在列元素中:
<pivotTable...>  <dimension axis='row'...>    <dimension axis='column'...>      <category...>        <cell text=’...' number='...' decimals='...'/>
     </category>      <category...>        <cell text='...' number='...' decimals='...'/>
     </category>    </dimension>  </dimension>     ...
 </pivotTable>

上述示例是结构的简化表示形式,显示这些元素的后代/前辈关系。但是,该示例不必显示父/子关系,因为存在通常会产生干扰作用的内嵌元素级别。

以下示例显示了简单频率表和该表的完整的输出 XML 表示形式。

表 1. 简单频率表
性别   频率 百分比 有效百分比 累积百分比
有效 女性 216 45.6 45.6 45.6
  男性 258 54.4 54.4 100.0
  总计 474 100.0 100.0  
图 1. 简单频率表的输出 XML
<?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>

您可能注意到,一个简单的小型表生成了大量的 XML。部分原因是,XML 包含一些在原始表中不明显的信息、一些甚至在原始表中不可用的信息以及一些冗余信息。

  • 显示(或应显示)在查看器的透视表中的表内容包含在文本属性中。示例如下:
    <command text="Frequencies" command="Frequencies"...>
  • 文本属性受输出语言和影响变量名称/标签和值/值标签显示的设置的影响。在此示例中,文本属性值不相同,这取决于输出语言,而命令属性值保持相同,不管输出语言是什么。
  • 只要在行标签或列标签中使用了变量或变量值,XML 都将包含一个文本属性以及一个或多个附加属性值。示例如下:
    <dimension axis="row" text="Gender" label="Gender" varName="gender">     ...<category text="Female" label="Female" string="f" varName="gender">
  • 对于数值变量,将存在数字属性而不是字符串属性。只有在变量或值具有已定义的标签时,才有标签属性。
  • 包含数字的单元格值的 <cell> 元素将包含 text 属性以及一个或多个附加属性值。示例如下:
<cell text="45.6" number="45.569620253165" decimals="1"/>

数字属性是实际的、未经过四舍五入的数值,小数属性指示表中显示的小数位数。

  • 因为列嵌套在行中,所以标识每列的类别元素将对每行重复。例如,由于统计显示在列中,因此元素 <category text="Frequency"> 在 XML 中出现了三次:一次是在男性行,一次是在女性行,一次是在总计行。