I have an Xml File that looks like this:
<Head>
<Node Name="something" value="10"/>
<Node Name="somethingElse" value="3"/>
</head>
<Head>
<Node Name="something" value="10"/>
<Node Name="somethingElse" value="3"/>
</head>
What I want is to be able to create and object that contains two Objects which have a name and a key.
This is what I have so far:
public void XmlReaderMethod(string Path)
{
SomeObject object = new Object();
using (XmlTextReader xReader = new XmlTextReader(Path))
{
while (xReader.Read())
{
if (xReader.NodeType == XmlNodeType.Attribute)
{
if (xReader.Name == "Name")
{
object = new object(xReader.Name);
}
else if (xReader.Name == "Value")
{
object.Key = xReader.Name;
}
}
//For Every two objects
//OtherObject otherObject = new OtherObject(object1, object2);
}
}
}
But what I want it to do is to take every two SomeObject created with a name and a value to create a OtherObject that contains two someObject.