Click here to Skip to main content
15,885,309 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
is any command for generating class file from xsd in C# asp.net suggest me
Posted
Updated 26-Feb-18 22:48pm

You can use XSD.exe[^] for generating classes from XSD schemas.
 
Share this answer
 
Comments
Manfred Rudolf Bihy 30-Jul-11 10:52am    
Good answer! 5+
walterhevedeich 30-Jul-11 12:23pm    
Thank you. Can I have my 5 now? :laugh:
Abhinav S 30-Jul-11 12:26pm    
Well you get my 5! :)
XSD.exe is the best tool.
walterhevedeich 30-Jul-11 12:36pm    
Thank you Abhinav.
Espen Harlinn 30-Jul-11 12:31pm    
My 5
Xsd2code[^] appears to be another free tool available that could help you do this. I have not tried it myself, so am nor sure about the results.
 
Share this answer
 
Comments
Manfred Rudolf Bihy 30-Jul-11 10:53am    
Nice tool! 5+
Abhinav S 30-Jul-11 12:25pm    
Thank you Manfred.
Espen Harlinn 30-Jul-11 12:32pm    
Worth a closer look, my 5
Abhinav S 30-Jul-11 12:41pm    
Thank you Espen.
Hi,
Try the OXML-Library[^]. It works for me and I hope it will work for you too.

Regards,
 
Share this answer
 
v2
Comments
Abhinav S 30-Jul-11 12:26pm    
My 5.
Espen Harlinn 30-Jul-11 12:33pm    
Interesting link, my 5
Monjurul Habib 31-Jul-11 11:54am    
nice link.
hi rajjosh
For generate a class file from a xsd file,do one thing open your viual studio command prompt give full path of your file where it is present

Ex:Suppose your file is present in d: data folder and your file name is rajjosh.xsd so you need to type
c:\d: (press enter)
D:\>cd data (press enter)
D:\data>xsd rajjosh.xsd /CLASSES /LANGUAGE:CS (Pres Enter)

Hope this post useful for you and others

cheers
prafulla
 
Share this answer
 
XML
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:bookstore-schema" elementFormDefault="qualified" targetNamespace="urn:bookstore-schema">
    <xsd:element name="bookstore" type="bookstoreType" />
    <xsd:element name="comment" type="xsd:string" />
    <xsd:element name="author" type="authorName"/>
    <xsd:complexType name="authorName">
        <xsd:sequence>
            <xsd:element name="first-name" type="xsd:string" />
            <xsd:element name="last-name" type="xsd:string" />
        </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="bookstoreType">
        <xsd:sequence maxOccurs="unbounded">
            <xsd:element name="book" type="bookType" />
            <xsd:element ref="comment" minOccurs="0" />
        </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="bookType">
        <xsd:sequence>
            <xsd:element name="title" type="xsd:string" />
            <xsd:element ref="author" />
            <xsd:element name="price" type="xsd:decimal" />
        </xsd:sequence>
        <xsd:attribute name="genre" type="xsd:string" />
    </xsd:complexType>

</xsd:schema>
 
Share this answer
 
Comments
CHill60 19-Feb-15 8:38am    
In what way is this relevent to the original 3.5 year-old question???
One more solutions:
If you have any dependent file so command would be as below:
D:\data>xsd example.xsd example1.xsd /CLASSES (Pres Enter)
 
Share this answer
 
Comments
Graeme_Grant 27-Feb-18 6:51am    
How is this any different to the accepted Solution 1 answer that is over 6 years old! Please stick to current questions only.
Rupesh Kumar Sahu 28-Feb-18 4:46am    
yup...

Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900