inheritance vs xml

  • Thread starter Thread starter csharpula csharp
  • Start date Start date
C

csharpula csharp

Hello!

I have inheritance between classes which are the result of xml
serialization.
My question is how can I insure in serializaion stage that the hierarchy
in xml is according to inheritance hierarchy in classes?

Thank you very much!
 
Hello!

I have inheritance between classes which are the result of xml
serialization.
My question is how can I insure in serializaion stage that the hierarchy
in xml is according to inheritance hierarchy in classes?

Thank you very much!

*** Sent via Developersdexhttp://www.developersdex.com***

Hi,

Can you give more details? it;s not very clear where is your problem.
 
Hi,

E.g. try to deserialize the class tree, then validate the result.

Regards, Alex
[TechBlog] http://devkids.blogspot.com



cc> Hello!
cc>
cc> I have inheritance between classes which are the result of xml
cc> serialization.
cc> My question is how can I insure in serializaion stage that the
cc> hierarchy
cc> in xml is according to inheritance hierarchy in classes?
cc> Thank you very much!
cc>
cc>
cc>
 
My question is : if I have ClassA:ClassB and in xml Class B element has
a memeber which is not of type A or B - is there an error in loading
this xml?
 
Also - it suggests no error is raised by default, but you can detect
unknown nodes and do what you want:

http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.unknownnode.aspx

"By default, after calling the Deserialize method, the XmlSerializer
ignores XML nodes of unknown types. However, you can use this event to
handle such node types."

http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.unknownattribute.aspx

"By default, after calling the Deserialize method, the XmlSerializer
ignores XML attributes of unknown types. However, you can use this event
to handle such node types."

Marc
 
Back
Top