我正在尝试创建一个使用Web服务的Android应用程序。我想使用XDocument
来阅读XML文件。我在我的项目中创建了一个名为xmlfolder
的文件夹,并将我的XML文件myxml
放入其中。用XDocument读取xml文件
我尝试过其他解决方案,例如How to load XML file located inside the folder of the application in window phone 7?,但似乎不起作用。我不断收到错误:
System.IO.DirectoryNotFoundException: Could not find a part of the path "/xmlfolder/myxml.xml"
。
和
myxml.xml myxml is null
这里是我的尝试:
if (string.IsNullOrEmpty(myFIileXML))
{
XDocument loadedData = XDocument.Load ("xmlfolder/myxml.xml");
myFileXML = loadedData.ToString();
}
[XDocument读取具有名称空间的根元件的XML文件]的可能副本(http://stackoverflow.com/questions/19142606/xdocument-reading-xml-file-with-root-element-having-namespaces) – Monika
你的文件设置为“content”和“always always”? – MarcinJuraszek
@Monika谢谢你的回复。但我已经通过这个链接,但似乎并没有解决我的问题。我只是无法找到该文件。 – user3034944