I try to read an xml file with almost 8 leves of child nodes but without succsses. I try using LINQ, SelectNode, SelectSingleNode, try to use a dumb foreach over XMLNodeList. In my last intent I use this dumb foreach over the XMLNodeList to try to catch the text or value of some nodes. These nodes are in diferents levels of deep but I can get onle the first element in sequesnse but the rest only repeat the firs value.
This is part of my code.
XmlDocument xDocXML = new XmlDocument();
xDocXML.Load(file_name);//file_name is a string with the full path of the file
XmlNodeList Article = xDocXML.SelectNodes("/ArticleSet/Article/Document"); //We get the Document of the article
foreach(XmlNode n in Article)
{
spmid = n["ID"].InnerText;
liga = string.Concat(TestString1, spmid);
//Test 1
//stitle = n.SelectSingleNode("//Article/ArticleTitle").InnerText;
//Test 2
//stitle = n["//Article/ArticleTitle"].InnerText;
XmlNode titles = n.SelectSingleNode("//Article/ArticleTitle");
stitle = titles.InnerText;//This line only work once and it repeat in all xmlnodes read
camposcuenta = camposcuenta + 1;
dt_abstractdb.Rows.Add(new Object[] { camposcuenta.ToString(), spmid, stitle, sresum, liga, ligaPDF, ligadoi });
}
Any suggestion over this