tags:

views:

385

answers:

2

Can someone please remind me how to create a .Net class from an XML file?

I would prefer the batch commands, or a way to integrate it into the shell.

Thanks!

A: 

You might be able to use the xsd.exe tool to generate a class, otherwise you probably have to implement a custom solution against your XML

XML Schema Definition Tool

XML Serialization

Quintin Robinson
+2  A: 

The below batch will create a .Net Class from XML in the current directory.
So... XML -> XSD -> VB

(Feel free to substitute CS for Language)

Create a Convert2Class.Bat in the %UserProfile%\SendTo directory.
Then copy/save the below:

@Echo off
Set XsdExePath="C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\XSD.exe"
Set Language=VB
%~d1
CD %~d1%~p1 
%XsdExePath% "%~n1.xml" /nologo
%XsdExePath% "%~n1.xsd" /nologo /c /language:%Language%

Works on my machine - Good Luck!!

Nescio