【发布时间】:2016-09-20 05:01:15
【问题描述】:
http://rtt.metroinfo.org.nz/RTT/Public/Utility/File.aspx?ContentType=SQLXML&Name=JPPlatform.xml
这两个都是我使用 HttpClient 拉下的示例数据,我想获取属性(?),例如 PlatformTag、ETA 等。
这是使用适用于 Windows 10 移动版和桌面版的通用应用程序。但我无法弄清楚这是怎么回事。
XDocument Document = XDocument.Parse(RESPONSE_CONSTANT);
var Stops = from Stop in Document.Descendants("Platform")
select new
{
Platformtag = (string)Stop.Attribute("PlatformTag"),
Platformno = (string)Stop.Attribute("PlatformNo")};
foreach (var item in Stops)
BusData.Text = item.Platformtag;
}
是我目前拥有的,但没有任何东西来自它,它只是坐在那里就像什么也看不见,从这里我对 XML Parsing 的了解还不够,无法找到下一步。
注意:Response_Constant 包含这样的数据:http://rtt.metroinfo.org.nz/RTT/Public/Utility/File.aspx?Name=JPRoutePositionET.xml&ContentType=SQLXML&PlatformTag=536
【问题讨论】:
-
到目前为止你尝试过什么?您在实施解决方案时遇到了哪些问题?
-
总是得到这个作为回复是什么意思,我已经尝试了简单的 XML 解串器我不再有我尝试过的代码,因为它没有做我需要的,所以我摆脱了它.我尝试过 stackoverflow.com/questions/10150785/using-xmltextreader 和其他 XML 反序列化技术,但由于这不是标准 XML,它们不会按照我希望的方式工作