1

I'm trying to replicate the output of a program that uses the DataSet.WriteXml method to write the xml schema. It puts minOccurs="0" at the end of each element:

 <xs:element name="record_type" type="xs:string" minOccurs="0" />

When I try to write the schema like this:

XmlSchema schema = XmlSchema.Read(xsd_FileStream, null);
XmlTextWriter xmlWriter = new XmlTextWriter(FileName, null);
xmlWriter.Formatting = Formatting.Indented;
xmlWriter.WriteStartDocument(true);
xmlWriter.WriteStartElement("NewDataSet");

schema.Write(xmlWriter);

I get elements that look like this instead:

<xs:element minOccurs="0" name="record_type" type="xs:string" />

1 Answers1

1

www.w3.org Section 3.1 Says that

Note that the order of attribute specifications in a start-tag or empty-element tag is not significant.

So, you do not need to have concern about the order of the attributes.

Another Reference on SO

Derviş Kayımbaşıoğlu
  • 28,492
  • 4
  • 50
  • 72