Why to bother with the dataset at all. You can deserialize directly to your objects, like this:
var xmlSerializer = new XmlSerializer(typeof(PropertyInformation));
var propInfo = (PropertyInformation) xmlSerializer.Deserialize(readStream);
return propInfo.Locations;
You need to add couple of attributes to your classes however:
public class Room
{
[XmlAttribute("name")]
public String Name { get; set; }
public int Capacity { get; set; }
}
public class Building
{
[XmlAttribute("name")]
public String Name { get; set; }
[XmlArray("Rooms")]
[XmlArrayItem("Room")]
public List<Room> Rooms { get; set; }
}
public class Location
{
[XmlAttribute("name")]
public string Name { get; set; }
[XmlArray("Buildings")]
[XmlArrayItem("Building")]
public List<Building> Buildings { get; set; }
}
[XmlRoot("PropertyInformation")]
public class PropertyInformation
{
[XmlArray("locations")]
[XmlArrayItem("location")]
public List<Location> Locations { get; set; }
}