如何将ASP.NET网站从外部XML读取数据转化为长尾关键词?
- 内容介绍
- 文章标签
- 相关推荐
本文共计308个文字,预计阅读时间需要2分钟。
我想读取位于+here的XML文件,数据看起来像这样:profile steamID6476561197967256555/steamID64 steamID![[CDATA[snivfbo]]]/steamID onlineStateoffline/onlineState stateMessage![[CDATA[]]]/stateMessage privacyStateprivate/privacyState
我想读一个位于 here的XML文件数据看起来像这样
<profile> <steamID64>76561197967256555</steamID64> <steamID><![CDATA[snivfbo]]></steamID> <onlineState>offline</onlineState> <stateMessage><![CDATA[]]></stateMessage> <privacyState>private</privacyState> <visibilityState>1</visibilityState> <avatarIcon><![CDATA[media.steampowered.com/steamcommunity/public/images/avatars/9d/9d13f8f8061b7adaa9e9c2766e2bb2b3d82f911c.jpg]]></avatarIcon> <avatarMedium><![CDATA[media.steampowered.com/steamcommunity/public/images/avatars/9d/9d13f8f8061b7adaa9e9c2766e2bb2b3d82f911c_medium.jpg]]></avatarMedium> <avatarFull><![CDATA[media.steampowered.com/steamcommunity/public/images/avatars/9d/9d13f8f8061b7adaa9e9c2766e2bb2b3d82f911c_full.jpg]]></avatarFull> <vacBanned>0</vacBanned> <isLimitedAccount>0</isLimitedAccount> </profile>
而我只是希望能够访问这些值.我对XmlTextReaders的了解有限,这让我无处可去.谢谢.
XDocument doc = XDocument.Load("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;
本文共计308个文字,预计阅读时间需要2分钟。
我想读取位于+here的XML文件,数据看起来像这样:profile steamID6476561197967256555/steamID64 steamID![[CDATA[snivfbo]]]/steamID onlineStateoffline/onlineState stateMessage![[CDATA[]]]/stateMessage privacyStateprivate/privacyState
我想读一个位于 here的XML文件数据看起来像这样
<profile> <steamID64>76561197967256555</steamID64> <steamID><![CDATA[snivfbo]]></steamID> <onlineState>offline</onlineState> <stateMessage><![CDATA[]]></stateMessage> <privacyState>private</privacyState> <visibilityState>1</visibilityState> <avatarIcon><![CDATA[media.steampowered.com/steamcommunity/public/images/avatars/9d/9d13f8f8061b7adaa9e9c2766e2bb2b3d82f911c.jpg]]></avatarIcon> <avatarMedium><![CDATA[media.steampowered.com/steamcommunity/public/images/avatars/9d/9d13f8f8061b7adaa9e9c2766e2bb2b3d82f911c_medium.jpg]]></avatarMedium> <avatarFull><![CDATA[media.steampowered.com/steamcommunity/public/images/avatars/9d/9d13f8f8061b7adaa9e9c2766e2bb2b3d82f911c_full.jpg]]></avatarFull> <vacBanned>0</vacBanned> <isLimitedAccount>0</isLimitedAccount> </profile>
而我只是希望能够访问这些值.我对XmlTextReaders的了解有限,这让我无处可去.谢谢.
XDocument doc = XDocument.Load("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;

