I want to read through any XML document and find each element with an attribute called "DataCode".
The xml documents come from various vendors and will have different schemas. The code below works for each child of the root node. But not for grand children or great grand children.
How can I read thru the xml document as if it was a array?
XDocument doc = _xDocument;
IEnumerable<XElement> childList =
from el in doc.Root.Elements()
foreach (XElement e in childList)
IEnumerable<XAttribute> attList = e.Attributes("DataCode");
foreach (XAttribute att in attList)
Debug.WriteLine("datacode found " + att.Value);