I get an XmlDocument from an external source.
I want to load it/map it to C# class.
I'm creating classes as I learn about the format. many tag are yet unparsed,
but that seems ok for the XmlSerializer, great!
Now here is my problem.
let say my document conceptually map to classes like that:
public class Foo
{
public string Something;
}
public class Bar
{
public Foo Foo1;
public Foo Foo2;
public List<Foo> ListFoo1;
public List<Foo> ListFoo2;
}
the problem is it's write this way:
<bar>
<foo1>
<something>lalala</something>
</foo1>
<foo2>
<Foo>
<something>lalala</something>
</Foo>
</foo2>
<ListFoo1>
<Foo>
<something>lalala</something>
</Foo>
<Foo>
<something>lalala</something>
</Foo>
<!-- ... etc .. -->
</ListFoo1>
<ListFoo2>
<afoo>
<Foo>
<something>lalala</something>
</Foo>
</afoo>
<!-- ... etc .. -->
</ListFoo2>
</bar>
as you could see. a class / property is some time:
- just tagged with its name <myprop><!-- value --></myprop>
- or 2 tagged, with the class inside <myprop><Foo><!--
value --></Foo></myprop>
kind of similar for the array where it's
- sometimes array of class:
<ListFoo1><Foo><!-- content --></Foo> ...</ListFoo1>
- or some other times there is a named wrapper as in
<ListFoo2><afoo><Foo><!-- content --> </Foo></afoo> .... </ListFoo2>
Fortunately, the behavior is fixed for a given property! (of course)
Now how could I use read/write C# class from/to this kind of XmlDocument
with minimum effort?
what kind of class/attributes/etc should I use?
Thanks for any tips!