XmlDocument xmldoc = new XmlDocument();
xmldoc.XmlResolver = null;
xmldoc.Load("URL");
XmlWriter xmlWrite = XmlWriter.Create(@Server.MapPath("Test.xml"));
xmldoc.Save(xmlWrite);
xmlWrite.Close();
Run Code Online (Sandbox Code Playgroud)
以上是我用来读取XML文件的代码.我加载的XML包含类似的实体nbsp;,因此,代码抛出了一个XMLException:
提及未申报实体'nbsp'