views:

189

answers:

1

How do I generate, based on a xsd and c#, an xml containing only the mandatory elements. I would prefer to use xlinq but I am also open to alternatives.

A: 

Is this a single fiexed xsd? Or is the xsd determined at runtime? With a fixed xsd, you could map it to an object model and use XmlSerializer:

xsd foo.xsd /classes

(at the command line; generates foo.cs with classes for entities etc)

Then build your object-model, and use XmlSerializer to serialize it. It might work - but isn't a suitable option for working with xsd on the fly.

Marc Gravell