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.
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.