Xaisoft
Xaisoft

Reputation: 46651

Is it possible to generate classes from an xml file?

I usually auto generate the classes by building and xsd file first. Is it possible given an xml file, for it to generate poco classes for you?

Upvotes: 1

Views: 322

Answers (1)

Oded
Oded

Reputation: 499372

This is possible - the XSD will be approximate (it will conform to the document you give the tool, which may or may not be what you are looking for).

xsd.exe has this functionality.

From the several modes of operation:

XML to XSD: Generates an XML schema from an XML file.

And:

XSD to Classes: Generates runtime classes from an XSD schema file. The generated classes can be used in conjunction with System.Xml.Serialization.XmlSerializer to read and write XML code that follows the schema.

Which give you an automated way to classes from an XML file.

Upvotes: 2

Related Questions