从XML生成C#类
是的,可以通过使用 xsd.exe 来实现。
D:\temp>xsd test.xml Microsoft (R) Xml Schemas/DataTypes support utility [Microsoft (R) .NET Framework, Version 4.0.30319.1] Copyright (C) Microsoft Corporation. All rights reserved. Writing file 'D:\temp\test.xsd'. D:\temp>xsd test.xsd /classes Microsoft (R) Xml Schemas/DataTypes support utility [Microsoft (R) .NET Framework, Version 4.0.30319.1] Copyright (C) Microsoft Corporation. All rights reserved. Writing file 'D:\temp\test.cs'.
注意:
回答如何在开发人员命令提示符中更改目录到 d:\temp可能会很有用。
如果您为多维数组生成类,则 XSD.exe 生成器存在错误,但存在解决方法。