{" не ожидалось.} Deserialization Twitter XMLC#

Место общения программистов C#
Ответить
Anonymous
 {" не ожидалось.} Deserialization Twitter XML

Сообщение Anonymous »

Я вытаскиваю XML из Twitter через Oauth.

Код: Выделить всё


16434938
Lloyd Sparkes
lloydsparkes
Hockley, Essex, UK
Student
http://a3.twimg.com/profile_images/351849613/twitterProfilePhoto_normal.jpg
http://www.lloydsparkes.co.uk
false
115
9fdaf4
000000
220f7b
FFF7CC
F2E195
87
Wed Sep 24 14:26:09 +0000 2008
0
0
London
http://s.twimg.com/a/1255366924/images/themes/theme12/bg.gif
false
1965
false
false
false
false

Mon Oct 12 19:23:47 +0000 2009
4815268670
» @alexmuller your kidding? it should all be "black tie" dress code
<a href="http://code.google.com/p/wittytwitter/" rel="nofollow">Witty</a>
false
4815131457
8645442
false
alexmuller



< /code>
Я использую следующий код для Deserialize: < /p>

    public User VerifyCredentials()
{
string url = "http://twitter.com/account/verify_credentials.xml";
string xml = _oauth.oAuthWebRequestAsString(oAuthTwitter.Method.GET, url, null);

XmlSerializer xs = new XmlSerializer(typeof(User),"");

MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));

return (User)xs.Deserialize(ms);
}
И у меня есть следующее для моего пользователя class:
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class User
{

[XmlElement(ElementName = "id")]
public long Id { get; set; }

[XmlElement(ElementName = "name")]
public string Name { get; set; }

[XmlElement(ElementName = "screen_name")]
public string ScreenName { get; set; }

[XmlElement(ElementName = "location")]
public string Location { get; set; }

[XmlElement(ElementName = "description")]
public string Description { get; set; }

[XmlElement(ElementName = "profile_image_url")]
public string ProfileImageUrl { get; set; }

[XmlElement(ElementName = "url")]
public string Url { get; set; }

[XmlElement(ElementName = "protected")]
public bool Protected { get; set; }

[XmlElement(ElementName = "followers_count")]
public int FollowerCount { get; set; }

[XmlElement(ElementName = "profile_background_color")]
public string ProfileBackgroundColor { get; set; }

[XmlElement(ElementName = "profile_text_color")]
public string ProfileTextColor { get; set; }

[XmlElement(ElementName = "profile_link_color")]
public string ProfileLinkColor { get; set; }

[XmlElement(ElementName = "profile_sidebar_fill_color")]
public string ProfileSidebarFillColor { get; set; }

[XmlElement(ElementName = "profile_sidebar_border_color")]
public string ProfileSidebarBorderColor { get; set; }

[XmlElement(ElementName = "friends_count")]
public int FriendsCount { get; set; }

[XmlElement(ElementName = "created_at")]
public string CreatedAt { get; set; }

[XmlElement(ElementName = "favourties_count")]
public int FavouritesCount { get; set; }

[XmlElement(ElementName = "utc_offset")]
public int UtcOffset { get; set; }

[XmlElement(ElementName = "time_zone")]
public string Timezone { get; set; }

[XmlElement(ElementName = "profile_background_image_url")]
public string ProfileBackgroundImageUrl { get; set; }

[XmlElement(ElementName = "profile_background_tile")]
public bool ProfileBackgroundTile { get; set; }

[XmlElement(ElementName = "statuese_count")]
public int StatusesCount { get; set; }

[XmlElement(ElementName = "notifications")]
public string Notifications { get; set; }

[XmlElement(ElementName = "geo_enabled")]
public bool GeoEnabled { get; set; }

[XmlElement(ElementName = "Verified")]
public bool Verified { get; set; }

[XmlElement(ElementName = "following")]
public string Following { get; set; }

[XmlElement(ElementName = "status", IsNullable=true)]
public Status CurrentStatus { get; set; }

}
< /code>
Но когда это десеризация вышеуказанного XML, приложение бросает следующее: < /p>

$ exception {"В документе xml есть ошибка (2, 2)."} system.except /> innerexception {" не ожидалось."} System.Except Не могу. < /p>
У меня также есть код для получения статусов, который работает нормально. А также возможное решение?


Подробнее здесь: https://stackoverflow.com/questions/155 ... witter-xml
Ответить

Быстрый ответ

не ожидалось.} Deserialization Twitter XML" class="inputbox autowidth" />
не ожидалось.} Deserialization Twitter XML" />
Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C#»