XmlDocument.Save(string) does not supported in UWP Framework?

时间:2017-12-18 06:24:27

标签: c# xml uwp

i tried to compile that code,

but, it couldn't be compiled. because of 'XmlDocument' doesn't have string parameter function.

UWP Framework, does not it support XmlDocument.Save(string) ??

can anyone help me Save Xml File using XmlDocument in UWP Framework??

        StorageFolder InstallationFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
        string strPath = Path.Combine(InstallationFolder.Path, "Assets\\MySetting.xml");

        XmlDocument xdoc = new XmlDocument();
        xdoc.Save(strPath);

1 个答案:

答案 0 :(得分:1)

you can have a look here. https://docs.microsoft.com/en-us/uwp/api/Windows.Data.Xml.Dom.XmlDocument

You can get a string by GetXml(). You can save to a file by SaveToFileAsync(IStorageFile) You can first load an xml file by LoadFromFileAsync(IStorageFile) or LoadXml(String)

I hope that helps