I've written an XML Schema file by hand (not using the DataSet Designer in VS) and a corresponding XML file containing structured data to be read in.
I ran the xsd.exe program to generate a Typed DataSet class; on the whole it looks fine to begin with (ignoring how it uses lowercase for public class members), but when it comes to using the generated class nothing happens:
MyDataSet set = new MyDataSet();
set.ReadXml( "myData.xml" );
At this point all of the typed table members of the MyDataSet class have a .Count of 0.
Strangly enough, I can't get normal DataSets to work either:
DataSet set = new DataSet();
set.ReadXmlSchema("mySchema.xsd");
set.ReadXml( "myData.xml");
set.Tables.Count returns 7, which is right, but the tables are all empty.
Am I missing something obvious?
UPDATE:
After doing absolutely nothing set.Tables["extra"].Rows.Count returns the correct number of rows; but when I use a typed dataset it doesn't work, despite everything else being the same:
DataSet ds = new DataSet();
ds.ReadXml ( packageExamplePath );
System.Console.WriteLine( ds.Tables["extra"].Rows.Count );
Package st = new Package();
st.ReadXml( packageExamplePath );
System.Console.WriteLine( st.Tables["extra"].Rows.Count );
...prints this out to console:
19
0
Gah!