开发者

Generate a simple C# class from XML

开发者 https://www.devze.com 2023-01-08 05:03 出处:网络
Are there any good tools to generate a simple C# class from xml.I have tried XML spy but that takes the data into account and creates a far开发者_StackOverflow社区 too complex class structure.

Are there any good tools to generate a simple C# class from xml. I have tried XML spy but that takes the data into account and creates a far开发者_StackOverflow社区 too complex class structure.

All I want is basically a class for each element and properties for each sub element.


There is a tool that comes with Visual Studio, but it requires a schema - the schema can be inferred from the XML anyway:

http://sharpertutorials.com/using-xsd-tool-to-generate-classes-from-xml/

The tool is called xsd.exe and you can get to it via the Visual Studio command prompt:

xsd.exe /?


Use the xsd.exe tool to generate a XML Schema (XSD) and use that to create the class.

http://asp.dotnetheaven.com/howto/doc/xmlserialization/XSDToCls.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号