I'm looking into changing my application to load its xml format data files into DataTables (and a DataSet?) instead of deserializing them into classes. I can generate a dataset using xsd.exe, but I'm not having any luck finding any examples showing how to use it.
我正在考虑更改我的应用程序以将其xml格式数据文件加载到DataTables(和DataSet?)而不是将它们反序列化为类。我可以使用xsd.exe生成数据集,但我没有运气找到任何显示如何使用它的示例。
My Google searches have been hopelessly clogged with examples using xsd files as an intermediary in accessing database tables. Since my apps saving data files instead of querying a DB these aren't of any use to me.
使用xsd文件作为访问数据库表的中介,我的Google搜索已经无可救药地被阻塞了。由于我的应用程序保存数据文件而不是查询数据库,因此对我来说没有任何用处。
2 个解决方案
#1
6
Try out with. May be you need to format your xml.
尝试一下。可能需要格式化你的xml。
DataSet ds = new DataSet();
ds.ReadXml("xml file path");
#2
3
Is manually filling the schema and table an option?
手动填充架构和表是一个选项吗?
DataTable table = new DataTable();
table.ReadXmlSchema(xmlReader);
table.ReadXml(xmlReader);
#1
6
Try out with. May be you need to format your xml.
尝试一下。可能需要格式化你的xml。
DataSet ds = new DataSet();
ds.ReadXml("xml file path");
#2
3
Is manually filling the schema and table an option?
手动填充架构和表是一个选项吗?
DataTable table = new DataTable();
table.ReadXmlSchema(xmlReader);
table.ReadXml(xmlReader);