Deserialize an unknown class to show it in a property grid.

  • Thread starter Thread starter Romain TAILLANDIER
  • Start date Start date
R

Romain TAILLANDIER

Hi group

I read XML data which i sometime can't know their type. But i have to show
the property in a property grid.

for example i get the following xml :

</UnknownClass>

I can't have the declaration of UnknownClass, so i can't cast it in a known
type at the deserialization time. So i can't create an instance of the
object and can't show its properties.
But i am quite sure it is possible to create some object using the XML
definition, and dynamically re-create a basic structure that match the
properties, in order to juste show it in the property grid. but how can i do
that or workaroud it ?

i have googled for that and can't find any sample to deserialize unknown
data.
Please help.

ROM
 
You have a couple of options:

1. Run the XML for the object(s) through an XSLT transformation to look like
a DataSet and bind it to the Grid as data.

2. Run through the XML to get the object name and basic properties and code
gen an object. Reflection.Emit will allow you to compile the code gened
object.

For additional ideas, you can look at mock objects (SourceForge.net has a
..NET mock objects open source project). While mock objects are not set to
fulfill the exact need you have, the concept of creating them is similar.
---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
thank you coboy !!

The first solution isn't applyable.

But the second is exactly what i need !!
Thank you for your graet help.

ROM

"Cowboy (Gregory A. Beamer) - MVP" <[email protected]> a
écrit dans le message de
 
Back
Top