I have a code XML
similar to this:
<document>
<elemento>
</elemento>
</document>
and the following C # code: ( x
is an XmlDocument)
for (int i = 0; i < x.ChildNodes.Count; i ++)
{
var element = x.ChildNodes[i];
Console.WriteLine("Elemento: " + element.Name);
}
It turns out that it only lists the first child of the element, in the document
case and does not list the children of document
. How can I list all elements of code XML
, including children of children?