Sunday 15 January 2012

how to change the minoccur value in XSD, from C# -


I am creating a feature for converting datasets into XSD files. I am reading data from the database and in order to create an XSD file for creating a dataset, I am actually creating a dataset and databat and then I am using dataset. WRITEXMLSchema () to write the xsd file.

The attribute for all the elements in my xsd file is getting minoccur = 0

Is there any way that I can change minOccur = 2 or we can also add Maxocker as well Are there. P>

Below is my code

  Dataset MyDataSet = New Dataset ("Amp"); // It may be confusing, 'datatelle' will actually be // element in the XML file (rows). DataTable MyDataTable = New DataTable ("Employee"); MyDataSet.Tables.Add (MyDataTable); // column creates properties, so we can // link directly into a Gridview MyDataTable.Column.Add (New DataColumn ("ID", Typef (System.Int32), Faucet, MappingType.); MyDataTable.Column. Add (New DataColumn ("name", typef (string), blank, mapping type.); MyDataTable.Columns.Add (new DataColumn ("salary", typef (int), blank, mapping type, attribute)); // XSD MyDataSet.WriteXmlSchema (@ "C: \ Employee.xsd");   

I'm getting lower than the XSD file

  & lt ?; Xml Version = "1.0" standalone = "Yes"? & Gt; & lt; x S: schema id = "golfer" xmlns = "" xmlns: xs = "http://www.w3.org/2001/XMLSchema" xmlns: MSDAT = "vase: schema-microsoft-com: xml-msdata" & gt; ; & Lt; xs: element name = "emp" msdata: IsDataSet = "true" msdata: UseCurrentLocale = "true"> gt;: XS: complexType & gt; & lt; xs: like minOccurs = "0" maxOccurs = "Unbounded">  gt;: XX: complexType & gt; attribute name = "id" type = "x :: int "/> & Lt; Xs: attribute name = "name" type = "x: string" /> & Lt; Xs: attribute name = "pay" type = "x :: int" /> & Lt; / XS: complexType & gt; & Lt; / XS: element & gt; & Lt; / XS: Options & gt; & Lt; / XS: complexType & gt; & Lt; / XS: element & gt; & Lt; / XS: Schema & gt; & Lt; - EndFragment - & gt;   

I wanted to change the minOccurs and maxOccurs value

There XSD There is no method to influence the generation of datasets built for custom tools. I am loading after generation and am recommending post-processing manually by modifying XSD.

No comments:

Post a Comment