Question on XMLSerialization

  • Thread starter Thread starter Joe Cool
  • Start date Start date
J

Joe Cool

I have an XML file that is created by an application that I do not
have the source to and have no control over at all. I would like to
read this XML file using VS2005 VB with XMLSerialization. The
following XML file exhibits the structure of this file:

<Root>
<Group>
<TypeA Attrib1="xxx" Attrib2="xxx">
<TypeAProperty1>xxx</TypeAProperty1>
<TypeAProperty2>zzz</TypeAProperty2>
</TypeA>
<TypeB Attrib1="xxx">
<TypeBProperty1>xxx</TypeBProperty1>
</TypeB>
</Group>
</Root>

The problem is how to define a class that will be the target of the
Group node list. There can be a variable number of types. Different
types will have each own list of attributes and nodelist. The list of
types in the group can be any mix of different types in any order, but
the order matters.

I cannot figure out how to structure such a class. Any help will be
appreciated.
 
Joe,

Any reason that you want to use serialization because an XML file is a kind
of serialized file.

If this is the result of a XMLserialized object, than you never get it back
to that not knowed Type, you only have the property dataparts.

Why not just read it?

Cor
 
Joe,

Any reason that you want to use serialization because an XML file is a kind
of serialized file.

I do not have access to the code that generated the XML file, so I
have no idea if it is a product of serialization or not.
If this is the result of a XMLserialized object, than you never get it back
to that not knowed Type, you only have the property dataparts.

Why not just read it?

Since I have figured out how to use XMLSerialzation, I prefer to use
it when I can to read and write XML. But I'm afraid I am going to have
to go back to the DOM to read this one in.
 
Back
Top