How to execute the different set of xml nodes being detected by their
respective Attribute values using c#
I would like to execute different set of xml nodes which are being
identified by their respective attributes values in xml. But what i am
facing is that only the set 1 xml nodes are getting executed even the
second attribute value is being identified.Here is my current code:
for (int m = 0; m < 10; m++)
{
attrVal_New =
Update_Bugs[m].Attributes["TestCondition"].Value;
//m++;
foreach (string attr in attrVal_New.Split(','))
{
//string[] vals =
XDocument.Load(FilePath_EXPRESS_API_BugAdd_CreateBugs_DataFile).Root.Element("Bugs").Attribute("TestCondition").Value.Split(',');
//Console.WriteLine(vals);
Console.WriteLine(attr);
string attributelowercase = attr.ToLower();
//Step1: Create Bugs
List<string> BugWSResponseList1 = new List<string>();
Logger.Write("\n\n" + DateTime.Now + " : " + " :
START : Creation of a set of Bugs via bug.Add
API");
BugWSResponseList1 =
CreateBugs(FilePath_EXPRESS_API_BugAdd_CreateBugs_DataFile,
newValue);
Please find the sample xml as follows:
<DrWatson>
<Bugs Name="Testing 11" TestCondition="STATE">
<Bug>
<family>ESG</family>
<product>Dr.Watson</product>
<duplicateId>Blank</duplicateId>
<note></note>
</Bug>
<Bug>
<family>ESG</family>
<product>Dr.Watson</product>
<duplicateId>Blank</duplicateId>
<note></note>
</Bug>
</Bugs>
<Bugs Name="Testing 22" TestCondition="STATUS">
<Bug>
<family>ESG</family>
<product>Dr.Watson</product>
<duplicateId>Blank</duplicateId>
<note></note>
</Bug>
<Bug>
<family>ESG</family>
<product>Dr.Watson</product>
<duplicateId>Blank</duplicateId>
<note></note>
</Bug>
</Bugs>
</DrWatson>
Please note that there are different attribute value defined under
TestCondition as 'STATE' and STATUS. when running this loop second time
the attribute value is being detected as 'STATUS' but it executes the xml
nodes which are present under 'STATE' attribute value.Please suggest.
No comments:
Post a Comment