简体   繁体   中英

how to fetch particular attribute value from xml

  <test-case 
       name="Fiserv.QA.NewUI.Settings.ChangeAddressTelephoneNumber.ChangeAddress.Workflow.ChangeAddressTelephoneNumberTests.ChangeAddressFuncationality" 
       executed="True" 
       result="Success" 
       success="True" 
       time="102.315" 
       asserts="14">

I tried this

 dr[0] = node.SelectSingleNode("properties/property").Attributes["value"].Value;
 dr[1] = node.Attributes["name"].Value;
 dr[2] = node.Attributes["success"].Value;

But its not able to find the success attribute value and meanwhile its fetching name correctly. I would like to fetch the success value. Can anyone please tell me?

xml.Descendants("test-case").Select(e => e.Attribute("success").Value).ToList()

试试上面的事情

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM