Loading XML to DataSet using XSD -- Not loading all elements / attributes ????? RRS feed

  • Question

  • Here is the piece of code that loads the schedma, xml and populates the DataSet tables:

    public DataSet ds;
    ds = new DataSet();
    ds.EnforceConstraints =
    "test.xml", XmlReadMode.ReadSchema);
    printTblsAndColumns(); // this lists all tables from dataset ds and their columns/data types.

    My Question is : Shouldn't I see all elements / attributes described in the xsd either as a table or a column ??
    It seems to miss a bunch of them!!!!

    Can some one shed some light on this issue bugging me please?


    • Moved by Gavin Ying - MSFT Friday, June 17, 2011 6:24 AM Move to DataSet forum for better support. (From:XML, System.Xml, MSXML and XmlLite)
    Friday, June 10, 2011 2:08 PM

All replies

  • Well what exactly does that function printTblsAndColumns do? How does the schema look?
    MVP Data Platform Development My blog
    Friday, June 10, 2011 4:09 PM
  • I tried to post the full xsd , though the file size is around 50k this post complains that it's over 60k... I tried to trim it down to half its size even then this stupid post says it's over 60k bytes.. So I am quitting to post further unless someone really interested to research the issue...
    -- In the mean time I tried to switch around the element sections and once I did that, the one that were in the dataset table disappered and the one that wasn't there before now appeared.. So my conclusion is that the darn VS2010 is buggy!! unless some one takes up the chalenge and prove me wrong!!!

    Saturday, June 11, 2011 3:04 AM
  • Since we don't know how you've defined your .xsd (and whether or not it was something that was generated by VS), I don't think you can say that VS is buggy ... you're just missing something or not doing something totally correct.

    I have a really easy quick-and-dirty utility for creating an .xsd from a database query. Take a look at my blog post about it. Try the utility and compare the resulting .xsd with your .xsd.

    ~~Bonnie Berent [C# MVP]
    Saturday, July 9, 2011 4:40 PM