I cant get any display with the code below. I am simply trying to read the data from the xml file, and display it with the application. Batch Compiler will be my root node from my understanding. Eventually I will be putting the data in a csv file, but I am taking this slow to be sure and understand all the parts. Any advice would be great.
XML
<?xml version="1.0" encoding="utf-8" ?>
<BatchCompiler>
<batch>
<batchid>955698</batchid>
<transactions>
<transaction>
<image>..\images\955698_1_.tif</image>
<items>
<item>
<values>
<value>
<name>Bill Base Number</name>
<data>0002025330</data>
</value>-<value>
<name>acct_num2</name>
<data/>
</value>-<value>
<name>Tax Year</name>
<data>2015</data>
</value>
</values>
</item>
</items>
</transaction>
</transactions>
</batch>
</BatchCompiler>
CODE:
using System;
using System.Linq;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Linq;
using System.IO;
using System.IO.Compression;
using System.Windows;
using System.Windows.Forms;
namespace GetZip
{
class program
{
static void Main(string[] args)
{
XElement xml = XElement.Load("c:\\example\\extract\\index.xml");
var items = el.Elements("BatchCompiler").Elements("BatchCompiler").DescendantNodes();
items = from item in el.Elements("values").Elements("values").Descendants()
where item.Attribute("name").Value == "name"
select item.FirstNode;
foreach (XNode node in items)
{
Console.WriteLine(node.ToString());
}
}
}
}