I\'m creating a ping application for school with an XML full of URLs.
I lost an hour because of XmlNode.Value was resulting in a null.
Then I changed i
I had a similar situation. What I did is, I picked the first child of the current node and checked if it is XMLtext, then displayed its value.
XmlNodeList xNList = xDOC.SelectNodes("//" + XMLElementname);
foreach (XmlNode xNode in xNList)
{
if (xNode.ChildNodes.Count == 1 &&
xNode.FirstChild.GetType().ToString() == "System.Xml.XmlText")
{
XMLElements.Add(xNode.FirstChild.Value);
}
else
{
XMLElements.Add("This is not a Leaf node");
}
}