XML deserialization to Dataset and custom object

XML deserialization to Dataset and custom object

Post by clickbi.. » Tue, 02 May 2006 16:34:28



I have a xml document as follows returned from a web service

<Variables>

  <Status>ENABLED</Status>
  <UserDetails ID="21">
      <Name>
          <Title>Mr.</Title>
          <FName>John</FName>
          <MName>M</MName>
          <LName>Dahl</LName>
      </Name>
      <Gender>Female</Gender>
      <Address>
            <Line1>Sassan</Line1>
            <Line2>Massan</Line2>
            <City>Utah</City>
            <Country>USA</Country>
      </Address>
      <Phone>425265245</Phone>
      <Mobile>95686265487</Mobile>
      <Fax />
      <Homepage />
  </UserDetails>
  </Variables>

First I tried to deserialize this xml to Dataset using Dataset.ReadXML
method with XMLReadMode.IgonreSchema. But the attribute ID of
UserDetails is not deserialized. What I need it to deserialize the xml
into a dataset with only one table and all the xml elements &
attributes converted
to table columns.

The final result is to wrap the dataset to a Customer object. I even
tried to directly deserialize the xml to Customer object but that will
create child objects like Address, UserDetails etc.
So is there any way so that I can deserailize the xml to single table
Dataset or the Customer object with the elements & attributes mapped to
public
properties

 
 
 

1. custom object XML deserialization

A collegue and I having written a simple web service that exposes custom
objects. The XML serliazation works great on the web service and the
deserialaztion works great when consumed by a normal framework client (a
standard WinForms .NET app). But when we try to consume the web service from
a CF app we get some weird results. On the CF client app we are able to
deserialize standard data types (ints, strings, etc) but when the custom
objects come back all their values are null. One method returns an array of
custom objects. The array is populated with the correct number of items, but
each item is empty.

Does anyone know of any issues with CF and XML deserialization?

Thanks.

-Mikel

2. sucessor to latex->html ?

3. Typed DataSet,Generic DataSet,Custom business objects,XML String

4. Oregon PUC Hearing Summary

5. XmlTextReader custom deserialization

6. wooa, that sounded stupid

7. DataSet->XML->DataSet Producing XML Errors

8. Auto Re-daial on TCP-IP

9. Xml Deserialization problem in .Net

10. Xml Deserialization: how to detect the target type

11. XML Serialization is giving a strange error on deserialization (System.InvalidOperationException)

12. Object pool for Deserialization

13. VB.NET XML Deserialization - can't get at some of the values