OXML 表格結構 (OMS 指令)
OXML 是符合 spss-output 綱目的 XML。
OMS指令及子類型 ID 用作 OXML 中command及subType屬性的值。 例如:<command text="Frequencies" command="Frequencies"...> <pivotTable text="Gender" label="Gender" subType="Frequencies"...>這些屬性值不受輸出語言 (
SET OLANG) 或變數名稱/標籤或值/值標籤 (SET TVARS和SET TNUMBERS) 的顯示設定影響。- XML 區分大小寫。 元素名稱
pivotTable被視為不同於名為 "pivottable" 或 "Pivottable" 的元素 (後者不存在於 OXML 中)。 - 「OMS 控制台」或「OMS ID」對話框 (兩者在「公用程式」功能表上) 所產生的指令及子類型 ID 使用的大小寫與用於
command及subTypeOXML 屬性值的大小寫相同。 - 表格中顯示的所有資訊都包含在 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>
前述範例是結構的簡化表示法,顯示這些元素的後代/上代關係,但不一定是上下代關係,因為通常會有中間巢狀元素層次。 下圖顯示「檢視器」中所顯示的簡式表格,以及代表該表格的 OXML。

<?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>
您可能會注意到,簡單的小表格會產生大量的 XML。 這部分是因為 XML 包含原始表格中未立即顯示的部分資訊、原始表格中甚至可能無法使用的部分資訊,以及特定備援量。
- 在「檢視器」中樞紐表中顯示的 (或將要顯示的) 表格內容包含在
text屬性中。 例如:<command text="Frequencies" command="Frequencies"...>這些文字屬性可能同時受到輸出語言 (
SET OLANG) 和設定的影響,這些設定會影響變數名稱/標籤和值/值標籤 (SET TVARS和SET TNUMBERS) 的顯示。 在此範例中,text屬性值將根據輸出語言而有所不同,而command屬性值無論輸出語言為何都保持不變。 - 每當在列或欄標籤中使用變數或變數值時, XML 將包含文字屬性及一或多個其他屬性值。 例如:
<dimension axis="row" text="Gender" label="Gender" varName="gender"> ... <category text="Female"label="Female" string="f" varName="gender">在數值變數的情形下,會有
number屬性而沒有string屬性。label屬性只有在變數或值有定義的標記時才會出現。 - The <cell> elements that contain cell values for numbers will contain the
textattribute and one or more additional attribute values. 例如:<cell text="45.6" number="45.569620253165" decimals="1"/>number屬性是實際未四捨五入的數值,而decimals屬性指出表格中顯示的小數位數。 - 因為直欄是巢狀內嵌在列中,所以識別每一個直欄的種類元素會針對每一列重複。 例如,由於統計資料顯示在直欄中,因此元素
<category text="Frequency">在 XML 中出現三次-一次代表男性列,一次代表女性列,一次代表總計列。
「說明」系統中提供使用 XSLT 來轉換 OXML 的範例。