Desired output
I am trying to read an xml doc using xpath. I am able to read the some elements but some not. I am trying to read this xml file and write this information in an excel file
I tried the following
class Program
{
static void Main(string[] args)
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("C:/Users/mypc/Documents/project/myfile.xml");
XmlNode titleNode = xmlDoc.SelectSingleNode("//header");
using (StreamWriter outputFile = new StreamWriter("C:/Users/myuser/Documents/project/WriteLines.txt"))
{
if (titleNode != null)
Console.WriteLine(titleNode.InnerText.ToString());
outputFile.WriteLine(titleNode.InnerText);
}
Console.ReadKey();
}
}
My xml file looks like this
<header version="2.0">
<phone>1234567</phone>
<houseNumber>45</houseNumber>
<date>2015-09-19</date>
<deliveryId>12345696015</deliveryId>
</header>
Is there any way I can read the children and write it in excel file ?