我有以下代码(C#):
FinalXMLString = FinalXMLString + "<row " + xmlString + " />";
xmlString = "";
dataList.Clear();
}
StringReader streamreader = new System.IO.StringReader(FinalXMLString);
XmlTextReader xmlreader = new System.Xml.XmlTextReader(streamreader);
dataSet.ReadXml(xmlreader);
我的FinalXMLString如下所示:
<row EntryID = \"1\" ManufacturerID = \"59\" Name = \"Conbraco hkhkhklh\" AuditDate = \"2/22/2013 10:22:46 AM\" SqlLogin = \"UNITED-SYSTEMS\\jessical\" Application = \"G5;Desktop;admin\" ChangeType = \"U\" /><row EntryID = \"2\" ManufacturerID = \"59\" Name = \"Conbraco hkhkhklh\" AuditDate = \"3/18/2013 4:14:21 PM\" SqlLogin = \"uss2012SQL01\" Application = \"G5;Desktop;admin\" ChangeType = \"U\" />"
那是从调试器模式,所以反斜杠仍在那里。问题是ReadXml每次都失败。上面的xml格式不正确吗?任何帮助表示赞赏。
答案 0 :(得分:0)
基于该xml字符串,您有两个根元素。以下是FinalXmlString的简化示例:
<row />
<row />
尝试在行元素中包装这些元素示例:
<rows>
<row />
<row />
</rows>