So far I can display the
<group number=
and
<category number=
How can i display
<category label= attributes for each category?
Xml
<?xml version="1.0" encoding="UTF-8"?>
<outputTree xmlns="http://www.ibm.com/software/analytics/spss/xml/oms" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ibm.com/software/analytics/spss/xml/oms http://www.ibm.com/software/analytics/spss/xml/oms/spss-output-1.8.xsd">
<command command="Summarize" displayOutlineValues="label" displayOutlineVariables="label" displayTableValues="label" displayTableVariables="label" lang="en" text="Summarize">
<pivotTable subType="Report" text="Batch Processing Report">
<dimension axis="row" text="Cases">
<group label="Test Site" text="Test Site" varName="PLANT_DESC" variable="true">
<group hide="true" text="A">
<group string="A" text="AA" varName="PLANT_DESC">
<group label="Product" text="Product" varName="PROD_DESC" variable="true">
<group hide="true" text="A">
<group string="S" text="S" varName="PROD_DESC">
<group label="Batch Number" text="Batch Number" varName="BATCH_NO" variable="true">
<group hide="true" text="A">
<group number="3704542" text="3704542" varName="BATCH_NO">
<category number="1" text="1">
<dimension axis="column" text="Variables">
<category label="Batch Run" text="Batch Run" varName="BATCH_RUN_ID" variable="true">
<cell number="4202" text="4202" varName="BATCH_RUN_ID"/>
</category>
<category label="Application" text="Application" varName="APP_ID" variable="true">
<cell label="Calibration" number="101" text="Calibration" varName="APP_ID"/>
</category>
</dimension>
</category>
<category number="2" text="2">
<dimension axis="column" text="Variables">
<category label="Batch Run" text="Batch Run" varName="BATCH_RUN_ID" variable="true">
<cell number="4341" text="4341" varName="BATCH_RUN_ID"/>
</category>
<category label="Application" text="Application" varName="APP_ID" variable="true">
<cell label="Range Setting" number="201" text="Range Setting" varName="APP_ID"/>
</category>
</dimension>
</category>
</group>
</group>
</group>
</group>
</group>
</group>
</group>
</group>
</group>
</dimension>
</pivotTable>
</command>
</outputTree>
C
private void GetXMLData1()
{
try
{
XNamespace ns = "http://www.ibm.com/software/analytics/spss/xml/oms";
XDocument testXML = XDocument.Load(@"C:\Users\byilmaz\Desktop\SPSS_SITE\test.xml");
var cats = from cat in testXML.Descendants(ns + "dimension").Where
(cat => (string)cat.Attribute("axis") == "column" && (string)cat.Attribute("text") == "Variables")
select new
{
BATCH_NO = cat.Parent.Parent.Attribute("number").Value,
RUN_NO = cat.Parent.Attribute("number").Value,
}
;
foreach (var cat in cats)
{
//xmlTitle.Text += "Group Name: " + cat.groupName + " and Cat Id: " + cat.catId + " and Cat Name: " + cat.catName + " and Cat Cell: " + cat.catCell + "</br>";
xmlTitle.Text += "BATCH_NO: " + cat.BATCH_NO + " </br>";
xmlTitle.Text += "RUN_NO: " + cat.RUN_NO + " </br><hr>";
}
}
catch (Exception err)
{
throw (err);
}
}
Output
