My requirement here is to retrieve the node that matches the hostname (for eg. machine1) and I always get back no results. Please let me know what the problem is?
Thanks for the help in advance!!!
XDocument configXML = XDocument.Load("the below xml");
var q = from s in configXML.Descendants("lcsetting")
where ((string)s.Element("host") == hostName)
select s;
The actual xml:
<lcsettings>
<lcsetting env="prod">
<hosts usagelogpath="">
<host>machine1</host>
<host>machine2</host>
<host>machine3</host>
</hosts>
</lcsetting>
<lcsetting env="qa">
<hosts usagelogpath="">
<host>machine4</host>
<host>machine5</host>
<host>machine6</host>
</hosts>
</lcsetting>
<lcsetting env="test">
<hosts usagelogpath="">
<host>machine7</host>
<host>machine8</host>
<host>machine9</host>
</hosts>
</lcsetting>
</lcsettings>