I have a very long, very varied XML file that I am attempting to store portions of into a database. Now, I do not want to go through and hand-write 10,000 different objects to store the deserialized data into. Is there any way to define an Object based on what is found in the XML file?
For instance, if I had:
<objecttype1>
<attr1>Some string of text</attr1>
</objecttype1>
<objecttype1>
<attr2>123456789</attr2>
</objecttype1>
I would want an object similar to the following to be defined:
public class objecttype1 {
public string attr1 {get; set;}
public string attr2 {get; set;}
}
Basically, I want to deserialize the entire xml document into a variety of different objects with some sort of hierarchical structure representing the original xml document, and then extract data from those objects to put into my database based on their type. Is there any way/a better way to do this?