Generating Object Classes from XML

I ran into a need for generating classes that xml data can be deserialized into. I generally write this myself but today, I needed to do it faster.

Along came the Visual Studio XSD tool.

Open a VS command prompt.
Type ‘xsd file.xml’. This will generate a file.xsd.
Then type, ‘xsd file.xsd /classes’. This will generate a file.cs file that you can then use to deserialize into.

For more details, check out this cool link http://sharpertutorials.com/using-xsd-tool-to-generate-classes-from-xml/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: