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;
foreach (string attr in attrVal_New.Split(','))
{
Console.WriteLine(attr);
....
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.
Here is the code snippet for 'Update Bugs' as follows:
XmlDocument XDoc = new DrWatsonCore().LoadXMLFromFile(FilePath_EXPRESS_API_BugAdd_CreateBugs_DataFile);
XmlNodeList Update_Bugs = XDoc.GetElementsByTagName("Bugs");
i am using this part to identify the Attribute Tag Names in the xml available under 'TestCondition' in my xml.
This is what i am doing after your suggestion and i am facing the same issue again as i am picking up the second attribute value but the set of xml nodes available under STATE attribute value is getting executed.
for (int m = 0; m < 10; m++)
{
XmlAttributeCollection coll = Update_Bugs.Item(m).Attributes;
string value = coll.Item(m).Value;
attrVal_New = Update_Bugs[m].Attributes["TestCondition"].Value;
//m++;
foreach (string attr in attrVal_New.Split(','))
{
string attributelowercase = attr.ToLower();
//Step1: Create Bugs
List<string> BugWSResponseList1 = new List<string>();
BugWSResponseList1 = CreateBugs(FilePath_EXPRESS_API_BugAdd_CreateBugs_DataFile, newValue);
Update_Bugsobject.Update_Bugs- it looks like you did not post portion of the code that should be usingUpdate_Bugs[m]node...