sxylw

导航

 

            StorageFolder storageFolder = await ApplicationData.Current.LocalFolder.CreateFolderAsync("UserInputData", CreationCollisionOption.OpenIfExists);
            StorageFile storageFile = await storageFolder.CreateFileAsync(file, CreationCollisionOption.OpenIfExists);//file是你要建立的xml文件的名字
            Windows.Data.Xml.Dom.XmlLoadSettings xmlloadsettings = new XmlLoadSettings();
            xmlloadsettings.ProhibitDtd = false;
            xmlloadsettings.ResolveExternals = false;
            xmlloadsettings.ElementContentWhiteSpace = true;
            XmlDocument xmlDoc = new XmlDocument();
            var content = await FileIO.ReadTextAsync(storageFile);
            // Check if there is any content in the file, if not avoid the exception.
            if (!string.IsNullOrEmpty(content))

{

//里面添加对文件进行读取

}

else

{

//这里添加对文件进行写操作

}

posted on 2012-10-29 19:38  sxylw  阅读(318)  评论(0)    收藏  举报