I hope this class will help you, try XmlStuff.GetXmlStuffFromPath( string path ) for you Xml file.
Well there is the technique to get all Nodes from the Xml.
class XmlStuff
{
public string adr3 { get
public string city { get
public string departed_UK { get
public string residency { get
public bool oap { get
public string docs_posted { get
public string completion { get
public string date_received { get
public string transfer_date { get
public static XmlStuff GetXmlStuffFromPath(string path)
{
XmlStuff xmlStuff = new XmlStuff()
XmlDocument xmlDocument = new XmlDocument()
xmlDocument.Load(path)
foreach (XmlNode xmlNode in xmlDocument.ChildNodes)
{
switch (xmlNode.Name)
{
case "root":
foreach (XmlNode rootChildNode in xmlNode.ChildNodes)
{
switch (rootChildNode.Name)
{
case "contact":
foreach (XmlNode contactChildNode in rootChildNode.ChildNodes)
{
switch (contactChildNode.Name)
{
case "adr3":
xmlStuff.adr3 = contactChildNode.InnerText
break
case "city":
xmlStuff.city = contactChildNode.InnerText
break
case "time_in_spain":
foreach (XmlNode timeInSpainChildNode in contactChildNode.ChildNodes)
{
switch (timeInSpainChildNode.Name)
{
case "departed_UK":
xmlStuff.departed_UK = timeInSpainChildNode.InnerText
break
case "residency":
xmlStuff.residency = timeInSpainChildNode.InnerText
break
default:
break
}
}
break
case "oap":
xmlStuff.oap = Convert.ToBoolean(contactChildNode.InnerText)
break
case "case":
foreach (XmlNode caseChildNode in contactChildNode.ChildNodes)
{
switch (caseChildNode.Name)
{
case "docs_posted":
xmlStuff.docs_posted = caseChildNode.InnerText
break
case "completion":
xmlStuff.completion = caseChildNode.InnerText
break
case "payment_recieved_uk":
foreach (XmlNode paymentRecievedUkChildNode in caseChildNode.ChildNodes)
{
switch (paymentRecievedUkChildNode.Name)
{
case "date_received":
xmlStuff.date_received = paymentRecievedUkChildNode.InnerText
break
case "transfer_date":
xmlStuff.transfer_date = paymentRecievedUkChildNode.InnerText
break
default:
break
}
}
break
default:
break
}
}
break
default:
break
}
}
break
default:
break
}
}
break
default:
break
}
}
return xmlStuff
}
}