xsd 유틸리티를 사용하여 * .xsd 파일에서 * .cs 파일을 생성했습니다. 클래스의 인스턴스를 serialize하여 생성 된 클래스에서 xml을 생성하고 싶습니다. 직렬화되는 객체를 만들려면이 코드를 실행.net xml serialization
<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>
: 여기
<header>
<br/>
<br/>
<br/>
<br/>
</header>
내가 점점 오전없는 깨끗한 출력의 두 가지 예 :이 같은 '깨끗한'출력을 얻을 방법이 있나요 : 여기
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
은 XSD 유틸리티에서 생성 된 클래스
[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;
}
}
}
,