1

We have xml from a REST API and are currently handwriting POCO's for them. I vaguely recall that there were tools to do this automagically in Visual Studio.

What is the best way to generate POCO's from XML?

MedicineMan
  • 14,456
  • 32
  • 97
  • 142

2 Answers2

3

You can use xsd.exe to do so.

To create an xsd file:

xsd file.xml /outputdir:"C:\Temp"

To create classes from the xsd file:

xsd file.xsd /classes /outputdir:"C:\Temp"
Alex Mendez
  • 5,028
  • 1
  • 24
  • 23
1

xsd.exe might be what you are looking for.

This post shows how to make the c# class from the generated schema: https://stackoverflow.com/a/1133052/353147

Community
  • 1
  • 1
Chuck Savage
  • 11,491
  • 6
  • 47
  • 67