Load the XML file into a DataTable (not from the database)

I am learning about changing my application to load its XML data files into DataTables (and DataSet?) Instead of deserializing them into classes. I can generate the dataset using xsd.exe, but I was not lucky to find examples showing how to use it.

My Google searches were hopelessly crammed with examples using xsd files as an intermediary for accessing database tables. Since my applications save data files instead of database queries, they do not suit me.

+3
source share
2 answers

Give it a try. Perhaps you need to format your XML file.

    DataSet ds = new DataSet();
    ds.ReadXml("xml file path");
+6
source

?

DataTable table = new DataTable();
table.ReadXmlSchema(xmlReader);
table.ReadXml(xmlReader);
+3

Source: https://habr.com/ru/post/1724965/


All Articles