zoukankan      html  css  js  c++  java
  • metro 下载xml文件 GIS

    public class downClass1
    {
    public IStorageFile pResultStorageFile;
    public async Task<IStorageFile> down()
    {
    string CountriesFile = "fruit.xml";
    StorageFolder InstallationFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
    StorageFile file = await InstallationFolder.CreateFileAsync(CountriesFile);//下载到本地
    BackgroundDownloader ppp = new BackgroundDownloader();
    DownloadOperation pDownloadOperation = ppp.CreateDownload(new Uri("https://files.cnblogs.com/gisbeginner/fruit.xml"), file);
    await pDownloadOperation.StartAsync();
    pResultStorageFile = pDownloadOperation.ResultFile;
    return pResultStorageFile;
    }
    }

    获得一个pResultStorageFile 文件引用

    downClass1 pdownClass1 = new downClass1();
    pDownLoadFile = pdownClass1.down() ;
    pDownLoadFile1 = await pDownLoadFile;

     //获得流

    Stream Countries = await pDownLoadFile1.OpenStreamForReadAsync();

    //利用流 解析xml 

    XDocument xDOC = XDocument.Load(Countries);
    var query = from a in xDOC.Elements("kinds").Elements("kind").Elements(transferValue)
    select a.Value;
    foreach (var C in query)
    {
    string CC = C;
    }
    itemListView.ItemsSource = query;

  • 相关阅读:
    Android按钮事件的4种写法
    VB.NET转C#代码的工具
    C# FTP操作类
    Linq一对多联合查询
    软件工程师面试题(一)
    一道网传上海幼儿园升小学的数学题
    csdn博客刷点击率(java代码)
    .NET高端职位招聘要求
    csdn博客刷粉代码
    jQuery Ajax无刷新操作
  • 原文地址:https://www.cnblogs.com/gisbeginner/p/2689100.html
Copyright © 2011-2022 走看看