G
Guest
Hi,
Not sure what to use here. I have a fairly simply XML document and I'd like
to "load" it into a related class so that I can access data using class
properties, etc. I've been reading thing about "serialization", etc. but
can't quite find the right article. Maybe I'm looking at the wrong thing?
e.g. XML Doc is:
<root>
<name>Joe Smith</name>
<address>Somewhere</address>
<hobbies>
<hobby>fishing</hobby>
<hobby>walking</hobby>
</hobbies>
</root>
Load this into a class designed for this document e.g.:
AClass obj = new AClass(docAbove);
string name = obj.Name;
foreach (string hob in obj.Hobbies)...
etc.
Obviously I can do this manually by looking at nodes in the doc and writing
all the get accessors but there must be an easier way?
Thanks!
Not sure what to use here. I have a fairly simply XML document and I'd like
to "load" it into a related class so that I can access data using class
properties, etc. I've been reading thing about "serialization", etc. but
can't quite find the right article. Maybe I'm looking at the wrong thing?
e.g. XML Doc is:
<root>
<name>Joe Smith</name>
<address>Somewhere</address>
<hobbies>
<hobby>fishing</hobby>
<hobby>walking</hobby>
</hobbies>
</root>
Load this into a class designed for this document e.g.:
AClass obj = new AClass(docAbove);
string name = obj.Name;
foreach (string hob in obj.Hobbies)...
etc.
Obviously I can do this manually by looking at nodes in the doc and writing
all the get accessors but there must be an easier way?
Thanks!