How to iterate XML-formatted string through "foreach" loop in C#? -


i have string in xml format following content:

<?xml version="1.0" encoding="windows-1251" ?> <operation> <personoperation>     <name>john smith</name>     <phone>79161234586</phone>     <city>glasgow</city>         <date>2014-02-03</date>     <operationtype>join</operationtype>     <amount>9000.00</amount> </personoperation> <personoperation>     <name>bill satly</name>     <phone>78263211334</phone>     <city>london</city>     <date>2014-07-10</date>     <operationtype>stock</operationtype>     <amount>3000.00</amount> </personoperation> 

how can iterate string through "foreach" loop in c# , check if value of operationtype node equal "join"?

load string xmldocument , use selectnodes() method appropriate xpath query.

query iterate:

"operation/personoperation"


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -