Note: We are not supporting multiple XSD file to C# as of now.
Enter your XSD sample in the above textbox, it will be validated before converting into C# Class and if it is correct, then you will get C# Class output. Suppose you have below sample XSD Schema file
<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:tns='http://tempuri.org/PurchaseOrderSchema.xsd'
targetNamespace='http://tempuri.org/PurchaseOrderSchema.xsd'
elementFormDefault='qualified'>
<xsd:element name='PurchaseOrder' type='tns:PurchaseOrderType'/>
<xsd:complexType name='PurchaseOrderType'>
<xsd:sequence>
<xsd:element name='ShipTo' type='tns:USAddress' maxOccurs='2'/>
<xsd:element name='BillTo' type='tns:USAddress'/>
</xsd:sequence>
<xsd:attribute name='OrderDate' type='xsd:date'/>
</xsd:complexType>
<xsd:complexType name='USAddress'>
<xsd:sequence>
<xsd:element name='name' type='xsd:string'/>
<xsd:element name='street' type='xsd:string'/>
<xsd:element name='city' type='xsd:string'/>
<xsd:element name='state' type='xsd:string'/>
<xsd:element name='zip' type='xsd:integer'/>
</xsd:sequence>
<xsd:attribute name='country' type='xsd:NMTOKEN' fixed='US'/>
</xsd:complexType>
</xsd:schema>
Output:
namespace Wadl
{
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Xml.Serialization;
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.0.97.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("PurchaseOrderType", Namespace="http://tempuri.org/PurchaseOrderSchema.xsd")]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlRootAttribute("PurchaseOrder", Namespace="http://tempuri.org/PurchaseOrderSchema.xsd")]
public partial class PurchaseOrderType
{
[System.Xml.Serialization.XmlIgnoreAttribute()]
private System.Collections.ObjectModel.Collection
_shipTo;
[System.Xml.Serialization.XmlElementAttribute("ShipTo", Namespace="http://tempuri.org/PurchaseOrderSchema.xsd")]
public System.Collections.ObjectModel.Collection
ShipTo
{
get
{
return this._shipTo;
}
}
public PurchaseOrderType()
{
this._shipTo = new System.Collections.ObjectModel.Collection
();
}
[System.Xml.Serialization.XmlElementAttribute("BillTo", Namespace="http://tempuri.org/PurchaseOrderSchema.xsd")]
public USAddress BillTo { get; set; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Xml.Serialization.XmlAttributeAttribute("OrderDate", Form=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType="date")]
public System.DateTime OrderDateValue { get; set; }
[System.Xml.Serialization.XmlIgnoreAttribute()]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public bool OrderDateValueSpecified { get; set; }
[System.Xml.Serialization.XmlIgnoreAttribute()]
public System.Nullable
OrderDate
{
get
{
if (this.OrderDateValueSpecified)
{
return this.OrderDateValue;
}
else
{
return null;
}
}
set
{
this.OrderDateValue = value.GetValueOrDefault();
this.OrderDateValueSpecified = value.HasValue;
}
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.0.97.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("USAddress", Namespace="http://tempuri.org/PurchaseOrderSchema.xsd")]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class USAddress
{
[System.Xml.Serialization.XmlElementAttribute("name", Namespace="http://tempuri.org/PurchaseOrderSchema.xsd", DataType="string")]
public string Name { get; set; }
[System.Xml.Serialization.XmlElementAttribute("street", Namespace="http://tempuri.org/PurchaseOrderSchema.xsd", DataType="string")]
public string Street { get; set; }
[System.Xml.Serialization.XmlElementAttribute("city", Namespace="http://tempuri.org/PurchaseOrderSchema.xsd", DataType="string")]
public string City { get; set; }
[System.Xml.Serialization.XmlElementAttribute("state", Namespace="http://tempuri.org/PurchaseOrderSchema.xsd", DataType="string")]
public string State { get; set; }
[System.Xml.Serialization.XmlElementAttribute("zip", Namespace="http://tempuri.org/PurchaseOrderSchema.xsd", DataType="integer")]
public string Zip { get; set; }
[System.Xml.Serialization.XmlIgnoreAttribute()]
private string _country = "US";
[System.ComponentModel.DefaultValueAttribute("US")]
[System.Xml.Serialization.XmlAttributeAttribute("country", Form=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType="NMTOKEN")]
public string Country
{
get
{
return this._country;
}
set
{
this._country = value;
}
}
}
}