Hi,

Having problems understanding XML (de)serialization. I need to
serialize and deserialize objects to and from xml documents. I have
tested xsd.exe but the classes it generates from xml documents are not
very clean and collections don't seem to be generated properly.

My questions:
- What alternatives are there to xsd.exe for generating classes from
xml ?

- For testing purposes, I have written a class with a member of
generic type and serialized an object instance:

[Pseudo code]
Public Class Person
  Property Name
  Property Children as List(Of Child)
End Class

Public Class Child
  Property Name
End Class

Now when an object instance of the Person class is serialized, it
results in an xml file with this structure:
<Person>
  <Name></Name>
  <Children>
    <Child></Child>
    <Child></Child>
  </Children>
</Person>

What I need however (can't help this) is the following:
<Person>
  <Name></Name>
  <Child></Child>
  <Child></Child>
</Person>

Also, I need to deserialize the latter back into an object. How can I
do this? I have tried XMLIgnore attribute but it doesn't help in this
case.

Thanks for any help,
Kees



-- 
Subscription settings: 
http://groups.google.com/group/dotnetdevelopment/subscribe?hl=en

Reply via email to