locked
write xml from xml schema? RRS feed

  • Question

  • User-1669453032 posted

    Hi,

    i want to generate an xml by following the uploaded xml schemas. please see at here.

    how can i start to write that xml programatically.

    thanks

    Wednesday, January 21, 2015 7:10 AM

Answers

  • User1508394307 posted

    Read Generating XML Documents from XML Schemas

    In general, to make a document based on schema you need

    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);

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 21, 2015 7:18 AM

All replies

  • User1508394307 posted

    Read Generating XML Documents from XML Schemas

    In general, to make a document based on schema you need

    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);

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 21, 2015 7:18 AM
  • User-1669453032 posted

    thank you smirnovLaughing

    Wednesday, January 21, 2015 9:15 AM