I have an xml mapping file that looks something like this
Update
Summarized in a method:
public IEnumerable GetAttributes(string modelName, string colour)
{
XDocument mappings = XDocument.Load(@"D:\colour_mappings.xml");
var q1 =
from elm in mappings.Descendants("model")
where (string)elm.Attribute("name") == "modelY"
select elm;
var q2 =
from elm in q1.Descendants("mapping")
where (string)elm.Attribute("colour") == "White"
select elm.Attributes().Where(a => a.Name != "colour");
foreach (IEnumerable attributeList in q2)
{
foreach (XAttribute attribute in attributeList)
{
yield return attribute;
}
}
}