I used the xsd utility to generate a *.cs file from an *.xsd file. I'd like to generate xml from this generated class by serializing an instance of the class. Is there any way to get 'clean' output like this:
<header>
<br/>
<br/>
<br/>
<br/>
</header>
Here are two examples of the not clean output I am getting:
<header>
<br xsi:type="xsd:string" />
<br xsi:type="xsd:string" />
<br xsi:type="xsd:string" />
<br xsi:type="xsd:string" />
</header>
<header>
<br xsi:nil="true" />
<br xsi:nil="true" />
<br xsi:nil="true" />
<br xsi:nil="true" />
</header>
Running this code to create the object being serialized:
KioskSchema.applicationScreens screenContainer = new KioskSchema.applicationScreens();
//screenContainer.header = new object[] { null, null, null, null }; //didn’t work
//screenContainer.header = new string[] { "<br/>", "<br/>", "<br/>", "<br/>"}; //didn’t work
screenContainer.header = new string[] { string.Empty, string.Empty, string.Empty, string.Empty }; //didn’t work
Here is the class generated from the xsd utility
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class applicationScreens
{
private object[] headerField;
private applicationScreensScreen[] screenField;
/// <remarks/>
[System.Xml.Serialization.XmlArrayItemAttribute("br", IsNullable = false)]
public object[] header
{
get
{
return this.headerField;
}
set
{
this.headerField = value;
}
}
}