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;

  • 相关阅读:
    HTTP——Web服务器、代理、缓存
    nginx配置文件详解2
    nginx配置文件详解
    shell笔记2
    django笔记
    python 发请求,urllib,urllib2
    nginx配置
    python os模块学习
    mac 终端命令小结
    mac常用命令笔记
  • 原文地址:https://www.cnblogs.com/gisbeginner/p/2689100.html
Copyright © 2011-2022 走看看