error- 根级别的数据无效第 1 行位置 1。

error- Data at the root level is invalid Line 1 position 1.

请检查代码。即使在使用 doc.Load() 函数后我也会收到此错误。

Application.DoEvents();
XmlDocument xmldoc = new XmlDocument();
XmlNodeList xmlnode;
FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read);
xmldoc.Load(fs); 
xmlnode = xmldoc.GetElementsByTagName("Source");

检查代码:https://pastebin.com/4U7qa1L4

从 XML 文件夹中删除所有额外的隐藏文件。它不应包含除“.xml”以外的任何文件。您还必须使用 xmlfile.Load() 而不是 xmlfile.xmlLoad().