Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert xsd to xml using c#

Tags:

c#

xml

xsd

How can I generate xml from xsd without xsd.exe?

like image 487
kipregel Avatar asked Apr 19 '11 11:04

kipregel


1 Answers

I think I googled it for you. Use XmlSampleGenerator from MSDN

Sample use:

XmlTextWriter textWriter = new XmlTextWriter("po.xml", null);
textWriter.Formatting    = Formatting.Indented;
XmlQualifiedName qname   = new XmlQualifiedName("PurchaseOrder",       
                           "http://tempuri.org");
XmlSampleGenerator generator = new XmlSampleGenerator("po.xsd", qname);
genr.WriteXml(textWriter);
like image 67
sehe Avatar answered Sep 18 '22 20:09

sehe