读取xml文件 [英] read xml file
问题描述
您好,
我有一个WPF 4.0应用程序,并希望它在曲面演示模式下在曲面上运行。  它不是表面App。
i have a WPF 4.0 Application and want it to run on the surface within the surface presentation mode. It is not a surface App.
原因是我的主管希望在表面上展示这个wpf应用程序。
The reason is that my chief wants to show this wpf application on a fair on the surface.
当我尝试阅读时一个xml文件我得到一个例外。我使用以下代码来读取和解析xml文件:
When i try to read an xml file i get an exception. I use the following code to read and parse xml file:
XmlSerializer deserializer = new XmlSerializer(typeof(MosaicPlotRoot));
TextReader textReader = new StreamReader(path);
mosaicPlotRoot = (MosaicPlotRoot)deserializer.Deserialize(textReader);
textReader.Close();
我得到一个例外:
这是一个空引用,因为无法读取xml文件中的值,因此无效。
It is a nullreference because the value from an xml file cannot be read and is therefor null.
应用程序在笔记本电脑/ PC上正常运行。此外,当表面不处于表面模式时(正常的Windows 7模式)。
The application runs fine on a notebook/pc. Also when surface is not in surface mode (normal windows 7 mode).
我听说我需要在表面模式下读取/写入文件的特殊权限,因为应用程序运行的类似于沙箱?
I heard i need special permission in surface mode for reading/writing files because the app is running in something similar like a sandbox?
任何帮助?
推荐答案
在没有特殊权限的Surface模式下对我来说很好。
This works fine for me in Surface Mode without special permissions.
XmlDocument doc = new XmlDocument();
doc.Load("test.xml");
这篇关于读取xml文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!