我想知道为什么当我检索我的 XML 时我无法从中获取任何项目。
所以基本上我用手机连接到我的网络服务。
XML 返回目录信息和文件信息的 TUPLE。
<TupleOfArrayOfDirectoryInfoArrayOfFileInfoe_PmhuPqo xmlns="http://schemas.datacontract.org/2004/07/System" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<m_Item1 xmlns:a="http://schemas.datacontract.org/2004/07/System.IO">
<a:DirectoryInfo>
<OriginalPath xmlns="" xmlns:b="http://www.w3.org/2001/XMLSchema" i:type="b:string">AETN</OriginalPath>
<FullPath xmlns="" xmlns:b="http://www.w3.org/2001/XMLSchema" i:type="b:string">C:\inetpub\wwwroot\Files\TEST1</FullPath>
</a:DirectoryInfo>
<a:DirectoryInfo>
<OriginalPath xmlns="" xmlns:b="http://www.w3.org/2001/XMLSchema" i:type="b:string">BT</OriginalPath>
<FullPath xmlns="" xmlns:b="http://www.w3.org/2001/XMLSchema" i:type="b:string">C:\inetpub\wwwroot\Files\TEST2</FullPath>
</a:DirectoryInfo>
<a:DirectoryInfo>
<OriginalPath xmlns="" xmlns:b="http://www.w3.org/2001/XMLSchema" i:type="b:string">Comixology</OriginalPath>
<FullPath xmlns="" xmlns:b="http://www.w3.org/2001/XMLSchema" i:type="b:string">C:\inetpub\wwwroot\Files\TEST3</FullPath>
</a:DirectoryInfo>
在我的 windows phone 7 应用程序代码中,我在从正确的 url 下载 xml 后使用了这段代码:
void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Error == null)
{
XDocument xdoc = XDocument.Parse(e.Result, LoadOptions.None);
var folders = from query in xdoc.Descendants("DirectoryInfo")
select new Folder
{
Name = (string)query.Element("OriginalPath"),
};
listBox2.ItemsSource = folders;
}
}
我收到此错误:
'System.Collections.IEnumerable' does not contain a definition for 'System' and no extension method 'System' accepting a first argument of type 'System.Collections.IEnumerable' could be found (are you missing a using directive or an assembly reference?)