如何将XML文件转换成一个.NET类?如何将、文件转换成、XML、NET

2023-09-04 03:31:15 作者:蕝版╮好莮人

有人能提醒我如何从一个XML文件中创建一个.NET类?

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

我会$ PFER批处理命令p $,还是有办法将其整合到外壳。

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

谢谢!

推荐答案

下面的批次会在当前目录下创建一个.NET的类从 XML 。 所以... XML - > XSD - > VB

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

(随时随意替代CS的语言)

(Feel free to substitute CS for Language)

在%USERPROFILE%\的SendTo目录中创建一个 Convert2Class.Bat 。 然后复制/保存如下:

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%

作品在我的机器 - GOOD LUCK !!

Works on my machine - Good Luck!!