当我的xml文件数据使用Readxml读入DataSet时,我遇到了运行时错误。
“encoding”是一个意外的令牌。预期的令牌是'?>'“
我的C#代码是:
XmlReader xmlFile = XmlReader.Create("WH7_Inventory.xml", new XmlReaderSettings());
DataSet ds = new DataSet();
ds.ReadXml(xmlFile);
我的xml文件是
<?xml version="1.0" encoding="UTF-8" standalone="true"?>
答案 0 :(得分:0)
standalone
的属性值不正确。它应该是yes
或no
。
请参阅Standalone Document Declaration
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
虽然假设这是您在XML文档中的全部内容,但由于没有根元素,您可能仍会收到错误。