Getting values from XML string in C# -
this question has answer here:
- how 1 parse xml files? 11 answers
using api following xml string
<response> <ip>74.125.224.72</ip> <countrycode>us</countrycode> <countryname>united states</countryname> <regioncode>ca</regioncode> <regionname>california</regionname> <city>mountain view</city> <zipcode>94043</zipcode> <timezone>america/los_angeles</timezone> <latitude>37.4192</latitude> <longitude>-122.0574</longitude> <metrocode>807</metrocode> </response>
how able values in c# application, , make more professional.
for example:
ip: 74.125.224.72 country code: country name: united states region code: ca ect..
thanks
you have few choices here.
if want of values object, can use deserializer.
if want run queries against retrieve specific values, use either xmldocument , write xpath queries against or xdocument , write linq queries against it.
if you're literally looping through elements , printing off values, use xml reader.
Comments
Post a Comment