我想读一个位于 here的XML文件 数据看起来像这样 profile steamID6476561197967256555/steamID64 steamID![CDATA[snivfbo]]/steamID onlineStateoffline/onlineState stateMessage![CDATA[]]/stateMessage privacyStateprivate/privacyStat
数据看起来像这样
<profile>
<steamID64>76561197967256555</steamID64>
<steamID><![CDATA[snivfbo]]></steamID>
<onlineState>offline</onlineState>
<stateMessage><![CDATA[]]></stateMessage>
<privacyState>private</privacyState>
<visibilityState>1</visibilityState>
<avatarIcon><![CDATA[http://media.steampowered.com/steamcommunity/public/images/avatars/9d/9d13f8f8061b7adaa9e9c2766e2bb2b3d82f911c.jpg]]></avatarIcon>
<avatarMedium><![CDATA[http://media.steampowered.com/steamcommunity/public/images/avatars/9d/9d13f8f8061b7adaa9e9c2766e2bb2b3d82f911c_medium.jpg]]></avatarMedium>
<avatarFull><![CDATA[http://media.steampowered.com/steamcommunity/public/images/avatars/9d/9d13f8f8061b7adaa9e9c2766e2bb2b3d82f911c_full.jpg]]></avatarFull>
<vacBanned>0</vacBanned>
<isLimitedAccount>0</isLimitedAccount>
</profile>
而我只是希望能够访问这些值.我对XmlTextReaders的了解有限,这让我无处可去.谢谢.
XDocument doc = XDocument.Load("http://steamcommunity.com/profiles/76561197967256555/?xml=1");
string steamID64 = doc.Root.Descendants("steamID64").First().Value;
string steamID = doc.Root.Descendants("steamID").First().Value;
string onlineState = doc.Root.Descendants("onlineState").First().Value;
string stateMessage = doc.Root.Descendants("stateMessage").First().Value;
string privacyState = doc.Root.Descendants("privacyState").First().Value;
string visibilityState = doc.Root.Descendants("visibilityState").First().Value;
string avatarIcon = doc.Root.Descendants("avatarIcon").First().Value;
string avatarMedium = doc.Root.Descendants("avatarMedium").First().Value;
string avatarFull = doc.Root.Descendants("avatarFull").First().Value;
string vacBanned = doc.Root.Descendants("vacBanned").First().Value;
string isLimitedAccount = doc.Root.Descendants("isLimitedAccount").First().Value;
