P
Peter K
Hi
I call a url, and recive a string back - which is xml-like. That is, it
looks something like the following (a list of <case>s, containing various
items of data.):
<case>
<id>123</id>
<name>Peter K</name>
<group>6</group>
</case>
<case>
<id>321</id>
<name>Arnold B</name>
<group>6</group>
</case>
How can I best "deserialize" this xml to a list of objects?
At the moment I add a <cases> tag around the return string, and call
XmlDocument.LoadXml, and manually loop through the nodes "case", "id",
"name" etc, building up a list of Case objects.
But I wonder if I could use something more "automatic", like
XmlSerializer.Deserialize? Can this handle a list of objects - and what if
the xml-node names do not match the property names in my Case class, can I
provide a mapping for this?
Thanks,
Peter
I call a url, and recive a string back - which is xml-like. That is, it
looks something like the following (a list of <case>s, containing various
items of data.):
<case>
<id>123</id>
<name>Peter K</name>
<group>6</group>
</case>
<case>
<id>321</id>
<name>Arnold B</name>
<group>6</group>
</case>
How can I best "deserialize" this xml to a list of objects?
At the moment I add a <cases> tag around the return string, and call
XmlDocument.LoadXml, and manually loop through the nodes "case", "id",
"name" etc, building up a list of Case objects.
But I wonder if I could use something more "automatic", like
XmlSerializer.Deserialize? Can this handle a list of objects - and what if
the xml-node names do not match the property names in my Case class, can I
provide a mapping for this?
Thanks,
Peter