I want to read an XML file located here
The data looks like this
<profile>
<steamID64>ID1234</steamID64>
<steamID><![CDATA[NAME]]></steamID>
<onlineState>offline</onlineState>
<stateMessage><![CDATA[]]></stateMessage>
<privacyState>private</privacyState>
<visibilityState>1</visibilityState>
<avatarIcon><![CDATA[http://media.steampowered.com/c.jpg]]></avatarIcon>
<avatarMedium><![CDATA[http://media.steampowered.com/steamcommunity/public/images/avatars/9d/6.jpg]]></avatarMedium>
<avatarFull><![CDATA[http://media.steampowered.com/steamcommunity/public/images/avatars/9d/6.jpg]]></avatarFull>
<vacBanned>0</vacBanned>
<isLimitedAccount>0</isLimitedAccount>
</profile>
And I just want to be able to access those values. My limited knowledge of XmlTextReaders has lead me no where. Thank you.
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With