Ok so heres the code snippet.
XDocument themes = XDocument.Load(HttpContext.Current.Server.MapPath("~/Models/Themes.xml"));
string result = "";
var childType = from t in themes.Descendants()
where t.Attribute("name").Value.Equals(theme)
select new { value = t.Attribute("type").Value };
foreach (var t in childType) {
result += t.value;
}
return result;
and heres the xml
<?xml version="1.0" encoding="utf-8" ?>
<themes>
<theme name="Agile">
<root type="Project">
<node type="Iteration" >
<node type="Story">
<node type="Task"/>
</node>
</node>
</root>
</theme>
<theme name="Release" >
<root type="Project">
<node type="Release">
<node type="Task" />
<node type="Defect" />
</node>
</root>
</theme>
</themes>
what am I doing wrong? I keep getting an object not set to an instance of an object exception.
----edit-----
ok let me add abit more, what I'm trying to return is the type of the selected node based on the type of a parent node, IE, if the theme is "Agile" and the parent node is "Project" then the return value should be "Iteration". Thats the final outcome but I never got that far because I got stuck with what you see above.