0

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 too complex class structure.

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

2 Answers 2

1

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 /?
Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.