I want to iterate through all attributes from all given tags in an XML file with C# like in this example.
<TAG1 Attribute1="1234" Attribute2="1234" Attribute3="1234">
<TAG2 xpq="123" abc="000" lkj="123"/>
</TAG1>
The XML is very long and the tags and attribute naming can change. So I must find a way to iterate through them with unknown naming. I have tested it with
XmlTextReader reader = new XmlTextReader("C:\\PathToXml\File.xml");
var optionTitle = reader.Name;
var AttributeName = reader.LocalName;
var AttributeValue = reader.GetAttribute(AttributeName);
var itemValue = new ListViewItem(new[] { optionTitle, AttributeName, AttributeValue });
listView1.Items.Add(itemValue);
But I only get the tag names and nothing else...
Does anyone have an idea for me?