Reading xml file causes HRESULT: 0xC00CE556 [dupli

2019-03-05 10:53发布

问题:

This question already has an answer here:

  • HRESULT: 0xC00CE556 - Loading string to XML 1 answer

I am writing a Windows 8.1 store app and I need to read a local xml file produces a general error trying to load the file.

Here's the file and code:

XmlDocument doc = new XmlDocument();
doc.LoadXml(@"C:\Users\Martin\Desktop\eventList2.xml");


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<EventList>1</EventList>

回答1:

doc.LoadXml() expects XML string as parameter. To load XML from file, use doc.Load(@"C:...");