Reading data from xml.

I have been through the many questions and answers on how to read data from an xml file. But it is not sinking in. I need to understand what is happening. I can currently read the info I need from a plain text file, but it is cumbersome (possibly not doing that correctly anyway). I thought using an xml file would be better. I need to read the data, to help construct a level. This should be very simple for someone who knows what they are doing.

My scenario: I want to make a grid at runtime. The data is stored in an xml file.
It has Level Name which I want to be an int (1).
It has a minimum value, aslo and int.
It has grid size, and int. (will be used twice but all boards are square)
then it has a series of 0,1 to denote a particular position, needs to be an array of ints,

Here is the xml.

<levels>
	<level>
		<name>1</name>
		<minimum>2</minimum>
		<size>3</size>
		<array>010010001</array>
	</level>
</levels>

This is stored in Assets/Resources so I can use Resources.Load. I would like to be able to keep all the level(s) into in this one file (instead of 120 different files. They would all contain the exact same info (different values). Anybody want to take a crack at reading 3 ints, and an array of ints from this xml?

I guess you can try using standard .Net xml parsing (for deserialization).

public TextAsset textFile;

// Load xml document from Textasset 
XmlDocument xmlDoc = new XmlDocument();
string xml = textFile.text;
xmlDoc.LoadXml(xml);

// xmldocument is loaded.
// start parsing.

string levelsxpath = "levels/level";
XmlNodeList nodes = xmlDoc.SelectNodes(levelsxpath);
for (int i = 0; i < nodes.Count; i++)
{
  string levelname = nodes*.SelectNode("name").value;*

int minimum = Convert.ToInt32(nodes*.SelectNode(“minimum”).value);*
}
Find out more [here][1].
_*[1]: Microsoft Learn: Build skills that open doors in your career