이 경우 xsd.exe 도구를 사용할 수 있습니다. 먼저 XML 코드에서 xsd 스키마를 만듭니다. 생성 된 스키마에서 클래스를 생성, 이제
xsd.exe form.xml
form.xml라는 파일에 XML을 저장 :
xsd.exe form.xsd /c
이것은 내가 가진 출력입니다.
//------------------------------------------------------------------------------
// <auto-generated>
// Este código fue generado por una herramienta.
// Versión de runtime:4.0.30319.42000
//
// Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si
// se vuelve a generar el código.
// </auto-generated>
//------------------------------------------------------------------------------
using System.Xml.Serialization;
//
// Este código fuente fue generado automáticamente por xsd, Versión=4.6.1055.0.
//
/// <comentarios/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
public partial class labels {
private labelsLabel[] labelField;
/// <comentarios/>
[System.Xml.Serialization.XmlElementAttribute("label", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public labelsLabel[] label {
get {
return this.labelField;
}
set {
this.labelField = value;
}
}
}
/// <comentarios/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
public partial class labelsLabel {
private string descriptionField;
private string languagecodeField;
/// <comentarios/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string description {
get {
return this.descriptionField;
}
set {
this.descriptionField = value;
}
}
/// <comentarios/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string languagecode {
get {
return this.languagecodeField;
}
set {
this.languagecodeField = value;
}
}
}
/// <comentarios/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
public partial class form {
private object[] itemsField;
/// <comentarios/>
[System.Xml.Serialization.XmlElementAttribute("labels", typeof(labels))]
[System.Xml.Serialization.XmlElementAttribute("tabs", typeof(formTabs), Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public object[] Items {
get {
return this.itemsField;
}
set {
this.itemsField = value;
}
}
}
/// <comentarios/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
public partial class formTabs {
private formTabsTab[] tabField;
/// <comentarios/>
[System.Xml.Serialization.XmlElementAttribute("tab", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public formTabsTab[] tab {
get {
return this.tabField;
}
set {
this.tabField = value;
}
}
}
/// <comentarios/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
public partial class formTabsTab {
private labelsLabel[][] labelsField;
private formTabsTabColumnsColumn[][] columnsField;
private string nameField;
/// <comentarios/>
[System.Xml.Serialization.XmlArrayItemAttribute("label", typeof(labelsLabel), Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
public labelsLabel[][] labels {
get {
return this.labelsField;
}
set {
this.labelsField = value;
}
}
/// <comentarios/>
[System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute("column", typeof(formTabsTabColumnsColumn), Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
public formTabsTabColumnsColumn[][] columns {
get {
return this.columnsField;
}
set {
this.columnsField = value;
}
}
/// <comentarios/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string name {
get {
return this.nameField;
}
set {
this.nameField = value;
}
}
}
/// <comentarios/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
public partial class formTabsTabColumnsColumn {
private formTabsTabColumnsColumnSectionsSection[][] sectionsField;
private string widthField;
/// <comentarios/>
[System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute("section", typeof(formTabsTabColumnsColumnSectionsSection), Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
public formTabsTabColumnsColumnSectionsSection[][] sections {
get {
return this.sectionsField;
}
set {
this.sectionsField = value;
}
}
/// <comentarios/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string width {
get {
return this.widthField;
}
set {
this.widthField = value;
}
}
}
/// <comentarios/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
public partial class formTabsTabColumnsColumnSectionsSection {
private labelsLabel[][] labelsField;
private formTabsTabColumnsColumnSectionsSectionRowsRowCell[][][] rowsField;
private string nameField;
/// <comentarios/>
[System.Xml.Serialization.XmlArrayItemAttribute("label", typeof(labelsLabel), Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
public labelsLabel[][] labels {
get {
return this.labelsField;
}
set {
this.labelsField = value;
}
}
/// <comentarios/>
[System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute("row", typeof(formTabsTabColumnsColumnSectionsSectionRowsRowCell[]), Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
[System.Xml.Serialization.XmlArrayItemAttribute("cell", typeof(formTabsTabColumnsColumnSectionsSectionRowsRowCell), Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false, NestingLevel=1)]
public formTabsTabColumnsColumnSectionsSectionRowsRowCell[][][] rows {
get {
return this.rowsField;
}
set {
this.rowsField = value;
}
}
/// <comentarios/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string name {
get {
return this.nameField;
}
set {
this.nameField = value;
}
}
}
/// <comentarios/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
public partial class formTabsTabColumnsColumnSectionsSectionRowsRowCell {
private labelsLabel[][] labelsField;
private formTabsTabColumnsColumnSectionsSectionRowsRowCellControl[] controlField;
private string idField;
/// <comentarios/>
[System.Xml.Serialization.XmlArrayItemAttribute("label", typeof(labelsLabel), Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
public labelsLabel[][] labels {
get {
return this.labelsField;
}
set {
this.labelsField = value;
}
}
/// <comentarios/>
[System.Xml.Serialization.XmlElementAttribute("control", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public formTabsTabColumnsColumnSectionsSectionRowsRowCellControl[] control {
get {
return this.controlField;
}
set {
this.controlField = value;
}
}
/// <comentarios/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string id {
get {
return this.idField;
}
set {
this.idField = value;
}
}
}
/// <comentarios/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
public partial class formTabsTabColumnsColumnSectionsSectionRowsRowCellControl {
private string idField;
/// <comentarios/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string id {
get {
return this.idField;
}
set {
this.idField = value;
}
}
}
내 경우에는 작지만 작동하지 않습니다. – Renar