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;

  • 相关阅读:
    java基础 01
    c++11——模板的细节改进
    c++11——auto,decltype类型推导
    poj_1182 并查集
    poj_1988 并查集
    poj_1161 并查集
    poj_3067 树状数组
    poj_2182 线段树/树状数组
    poj_1190 树状数组
    动态规划
  • 原文地址:https://www.cnblogs.com/gisbeginner/p/2689100.html
Copyright © 2011-2022 走看看