public void WriteXmlSchema4()
{
string xmlschema = @"<?xml version=""1.0"" encoding=""utf-16""?>
<xs:schema id=""Example"" xmlns="""" xmlns:xs=""http://www.w3.org/2001/XMLSchema"" xmlns:msdata=""urn:schemas-microsoft-com:xml-msdata"">
";
xmlschema = xmlschema + " <xs:element name=\"Example\" msdata:IsDataSet=\"true\" msdata:UseCurrentLocale=\"true\"";
xmlschema = xmlschema + @">
<xs:complexType>
<xs:choice minOccurs=""0"" maxOccurs=""unbounded"">
<xs:element name=""MyType"">
<xs:complexType>
<xs:attribute name=""ID"" type=""xs:int"" use=""required"" />
<xs:attribute name=""Desc"" type=""xs:string"" />
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>";
DataSet ds = new DataSet("Example");
// Add MyType DataTable
DataTable dt = new DataTable("MyType");
ds.Tables.Add(dt);
dt.Columns.Add(new DataColumn("ID", typeof(int), "",
MappingType.Attribute));
dt.Columns["ID"].AllowDBNull = false;
dt.Columns.Add(new DataColumn("Desc", typeof
(string), "", MappingType.Attribute));
ds.AcceptChanges();
StringWriter sw = new StringWriter();
ds.WriteXmlSchema(sw);
string result = sw.ToString();
Assert.Equal(result.Replace("\r\n", "\n"), xmlschema.Replace("\r\n", "\n"));
}