Generate an xml schema from a strongly typed dataset RRS feed

  • Question

  • Hello,

    I have an issue that I when I I use ReadXml() on my strongly typed dataset, that it does not throw and exception when the xml file is not compliant with the valid schema.  It just ignores the fact the file is not valid and loads no data silently.  I was looking at how to validate xml documents and the simplest way seems to be using an xml schema, hence why I would like to generate the valid xml schema from my dataset and not it have to write it myself. 

    I found plenty of examples of how to generate a dataset from an xml schema, but not the other way around.  It could just be that I am approaching this wrong, but it is important that I know the file is valid before I load it, as data could be lost otherwise.  The end user can select any xml file, hence why the validation is needed.

    Any help would be appreciated.


    • Edited by STiGuy_555 Thursday, July 18, 2013 8:57 AM
    Thursday, July 18, 2013 8:52 AM


  • Hi STiGuy_555,

    Per my understanding, you are trying to create your own dataset generator.

    Actually, you can try to check the code of xsd.exe which was used to generate dataset. You can use reflector tool to check the code. Xsd.exe ships with Windows SDK.

    Or you can share a sample which can reproduce the issue on skydrive, and I can help you check it.

    Best Regards,


    Friday, July 19, 2013 6:39 AM