Read XML Spreadsheet?

I have an XML file which contains a level, enemies, etc. for my game (linked below). How can I read the items into an array or a dictionary?

[46686-untitled-spreadsheet.txt|46686]

First, you need a directory class; this will hold the data you read from an XML file. I assume that Enemy is a class that has a variable “name” as string.

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Serialization;


[System.Serializable]
[XmlRoot("enemies")]
public class EnemyDirectory {
	[XmlElement("enemy")]
	public Enemy[] enemies;


}

The XML file needs to be ordered like this:

 +enemies
  +enemy
   -enemy attributes and elements etc.
  -enemy
  -enemy

The Enemy class needs to have each variable which corresponds to a XML attribute or element marked as such.

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Serialization;


[System.Serializable]
public class Enemy {
     [XmlAttribute("name")]
     public string name = "New Enemy";
}

For the actual XML file reading, you can di it like this:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using System.Xml.Serialization;

public class ReadFromXML: MonoBehaviour {

     public Dictionary<string,Enemy> enemyDictionary;//Might contains enemy names as string (Key) and enemy class instance as Value

     public void FillEnemyDictionary() {
		
		enemyDictionary = new Dictionary<string,Enemy>();
		
		string path = "C:/Enemies.xml";
		
		var xmlSerializer = new XmlSerializer(typeof(EnemyDirectory));
		var stream = File.Open(path, FileMode.Open);
		var deserializedEnemies = xmlSerializer.Deserialize(stream) as EnemyDirectory;
		
		stream.Close();
		
		for(int i = 0; i < deserializedEnemies.enemies.Length; i++) {
			Enemy enemy = deserializedEnemies.enemies*;*
  •  	enemyDictionary.Add (enemy.name, enemy);*
    
  •  }*
    
  • }*

}
There are tons of XML C# tutorials out there, btw.