Generate .Net Classes from XSD/XML


XSD ( XSD tool / XSD.exe ) To generate .Net Class file.

1.    We can use XSD Tool (Xml Schema Definition Tool) or XSD.exe to generate class files (.cs or .vb ) as per your requirements from Typed Datasets. 

2.    XSD.exe is the XML Schema Definition tool which generates XML schema or common language runtime classes from XDR, XML, and XSD files.

3.       The file locates at C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\XSD.exe
OR
C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin Depends up on your version of .Net.

4.    If you are having Express edition of ( V 2.0) then it might possible that you don’t have .Net command prompt option available in Start->Programs , then you have to go command prompt and goto location
“C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin”

and then type following with location of .xsd file on prompt to create.cs file
xsd.exe -c -l:c# C:\MyProjects\Employee\EmpTableDataSet.xsd

Or simply copy XSD.Exe file and .XSD files to same folder location on file system
and then type following with location of .xsd file on prompt to create .vb class files
xsd.exe /c /l:vb C:\path\MyXSDfile.xsd

5.       Example

C:\Cast\other\xsd>xsd.exe /c /l:vb OrderTypes.xsd

Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 2.0.50727.1432]
Copyright (C) Microsoft Corporation. All rights reserved.

Writing file 'C:\Cast\other\xsd\OrderTypes.vb'.

Comments

Popular posts from this blog

ContextSwitchDeadlock was detected

Visual Studio setup and deployment projects

Using SvcUtil.exe to generate the proxy class and config file