locked
Building an XML document from a Schema

    Question

  •  After years of using the DTD method for building XML docs, I now need to hand off to someone else a schema they need to use to build the doc to send back to me.

    I've been hunting through the documentation to find something to explain how, given just a schema, to use it to build an XML document with data content populated from C# (not Web) application. I've found plenty of entries on how to load an XML Doc and validate it against the schema, but nothing about having a schema and using it to build an XML Doc then send it off.

    I could just be looking in the wrong place.

    Anyone want to point me in direction?

    TIA
    Friday, October 31, 2008 12:29 PM

All replies

  • Are you talking about something like this?

    http://msdn.microsoft.com/en-us/library/229sz0y5.aspx

    FillSchema a DataAdapter from a schema file then set the schematype to source. 

    That should give you a DataSet with a new DataTable with the schema from your provided schema file.

    MCAD.NET MCTS Web 3.5 MCTS Data 3.5
    Wednesday, November 05, 2008 11:55 AM
  • Hi,

    You can do this very easily by simply opening the XSD file in the VS 2010 CTP which will open it in the XML Schema Designer. Selecting any possible root node from the XML Schema Explorer tree and right-click on it and select "Generate Sample XML".

    Hopefully this is what you are looking for.

    Thanks,
    Nihit
    Friday, November 07, 2008 2:53 AM