我在努力閱讀這個xml文件作爲朋友列表。 我需要的結果作爲朋友的列表(List<Friend>
)其中朋友是在C中解析xml#
public class Friend
{
public string UID {get;set;}
public string Provider {get;set;}
public string PhotoUrl {get;set;}
public string ProfileUrl {get;set;
}
<?xml version="1.0" encoding="utf-8"?>
<socialize.getFriendsInfoResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:com:gigya:api http://socialize-api.gigya.com/schema" xmlns="urn:com:gigya:api">
<statusCode>200</statusCode>
<errorCode>0</errorCode>
<statusReason>OK</statusReason>
<callId>ae61ae53a6094364998206a196874d04</callId>
<friends>
<friend>
<UID>_gid_Maj4wFcR3PA10EXENS/SfNhfszDYN9WRQzBgVyOPz0M=</UID>
<isSiteUser>false</isSiteUser>
<isSiteUID>false</isSiteUID>
<identities>
<identity>
<provider>facebook</provider>
<providerUID>100000378470436</providerUID>
<isLoginIdentity>false</isLoginIdentity>
<nickname>Afzal Raaz</nickname>
<photoURL>https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/70854_100000378470436_113535_s.jpg</photoURL>
<thumbnailURL>https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/70854_100000378470436_113535_q.jpg</thumbnailURL>
<firstName>Afzal</firstName>
<lastName>Raaz</lastName>
<gender>m</gender>
<profileURL>http://www.facebook.com/profile.php?id=100000378470436</profileURL>
</identity>
</identities>
<nickname>Afzal Raaz</nickname>
<photoURL>https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/70854_100000378470436_113535_s.jpg</photoURL>
<thumbnailURL>https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/70854_100000378470436_113535_q.jpg</thumbnailURL>
<firstName>Afzal</firstName>
<lastName>Raaz</lastName>
<gender>m</gender>
<profileURL>http://www.facebook.com/profile.php?id=100000378470436</profileURL>
</friend>
<friend>
<UID>_gid_T6vgh4MDshLvMYzi+Isxa0Ryf0ou2OJf+14pd6iwXlY=</UID>
<isSiteUser>false</isSiteUser>
<isSiteUID>false</isSiteUID>
<identities>
<identity>
<provider>facebook</provider>
<providerUID>100001052246730</providerUID>
<isLoginIdentity>false</isLoginIdentity>
<nickname>Ajaydeep Singh</nickname>
<photoURL>https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/203414_100001052246730_126837_s.jpg</photoURL>
<thumbnailURL>https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/203414_100001052246730_126837_q.jpg</thumbnailURL>
<firstName>Ajaydeep</firstName>
<lastName>Singh</lastName>
<gender>m</gender>
<profileURL>http://www.facebook.com/profile.php?id=100001052246730</profileURL>
</identity>
</identities>
<nickname>Ajaydeep Singh</nickname>
<photoURL>https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/203414_100001052246730_126837_s.jpg</photoURL>
<thumbnailURL>https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/203414_100001052246730_126837_q.jpg</thumbnailURL>
<firstName>Ajaydeep</firstName>
<lastName>Singh</lastName>
<gender>m</gender>
<profileURL>http://www.facebook.com/profile.php?id=100001052246730</profileURL>
</friend>
</friends>
</socialize.getFriendsInfoResponse>
還指定您正在使用哪個版本的.NET。如果你能夠使用LINQ to XML,它會讓你的生活變得更簡單。 – 2011-06-08 05:37:02