I need to provide wrapper to my current xml from which i am obtaining the keyvalye pair values. Here is my current code :
string SID_Environment = "SID_" + EnvironmentID.ToString();
XDocument XDoc = XDocument.Load(FilePath_EXPRESS_API_SearchCriteria);
var Dict_SearchIDs = XDoc.Elements().ToDictionary(a => (string)a.Attribute("Name"), a => (string)a.Attribute("Value"));
string Search_ID = Dict_SearchIDs.Where(IDAttribute => IDAttribute.Key == SID_Environment).Select(IDAttribute => IDAttribute.Value).FirstOrDefault();
Console.WriteLine(Search_ID);
Here is my sample xml as follows:
<APIParameters>
<Parameter Name="SID_STAGE" Value="101198" Required="true"/>
<Parameter Name="SID_QE" Value="95732" Required="true"/>
</APIParameters>
Please note that this code is working fine with the sample xml but after modifying my xml with some wrappers i am facing the issue. I need to provide some wrapper to my xml to modify my sample xml as follows:
<DrWatson>
<Sets>
<Set>
<APIParameters>
<Parameter Name="SID_STAGE" Value="101198" Required="true"/>
<Parameter Name="SID_QE" Value="95732" Required="true"/>
</APIParameters>
</Set>
</Sets>
</DrWatson>
But when i do it and run my code it throws me an error.Please suggest.