Click here to Skip to main content
11,502,547 members (37,657 online)
Click here to Skip to main content

Xml to VB.net Class Generator

, 3 Jul 2006 42K 2.1K 23
Rate this:
Please Sign up or sign in to vote.
Converts XML Document to VB.Net Class

Introduction

Sample screenshot

XML2Class Generator converts the XML Document to VB.Net Class. The reason behind developing this application was I have some components those returns xml string. I want to expose them out as strongly typed classes. I tried to implement Dataset by creating schema from xml and generating Dataset, but for the two reasons I left that idea.

Reason 1. Some of the tags in the xml documents have attributes and the dataset was created with child tables for each tag that has the attributes. I don’t like that approach.

Reason 2. I felt Dataset is too heavy to do this kind of work and it has lot of functionality that is not useful in this scenario.


Then I tought i would write a class manually which reads the xml document and copy the values to the class properties. But I felt it is laborious job, since the xml document has so many tags. I left this idea too.


Hence I decided to write XML to Class generator.

 

Features:

1. Generates class from xml. (This version only supports XML file with one root node )

2. Handles the xml attributes by converting them as separate properties. The xml attribute will be rendered as a property with this format “NodeName_Attributename”.

Example : <Name First=”Srinivas”/>

Attribute First will be created as property Name_First.

3.Can Be serialized from the xml.

I have included a sample project which has the logic to create an instance of the above generated class by deserializing from the xml.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Srinivas-Miriyala
Software Developer (Senior)
United States United States
No Biography provided

Comments and Discussions

 
General[My vote of 2] xsd Pin
Member 904093029-May-12 2:32
memberMember 904093029-May-12 2:32 
GeneralMy vote of 5 Pin
somethingfree12318-Jan-11 5:28
membersomethingfree12318-Jan-11 5:28 
GeneralMy vote of 1 Pin
Dave Kreskowiak7-Mar-10 15:44
mvpDave Kreskowiak7-Mar-10 15:44 
GeneralCouple things... [modified] Pin
BoneSoft3-Jul-06 9:40
memberBoneSoft3-Jul-06 9:40 
GeneralRe: Couple things... Pin
zhaojicheng18-Feb-09 2:00
memberzhaojicheng18-Feb-09 2:00 
GeneralRe: Couple things... Pin
BoneSoft18-Feb-09 2:20
memberBoneSoft18-Feb-09 2:20 
GeneralRe: Couple things... Pin
zhaojicheng18-Feb-09 4:21
memberzhaojicheng18-Feb-09 4:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150520.1 | Last Updated 3 Jul 2006
Article Copyright 2006 by Srinivas-Miriyala
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid