Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

XmlSerializer "hookup" when deserializing

$
0
0

Many times I have an object graph (root Object with properties which are collections of objects which in turn have... a.s.o.).
Often these are represented as xml files with a structure similar to:
<Root attr1="something">
  <Children>
    <Child name="First child">
      <GrandChildren>
        <GrandChild name="First grandchild"/>
        <GrandChild name="Second grandchild"/>
      </GrandChildren>
    <Child name="Second root child">
:
:

Then often each of the entities needs to refer it's "owner" or "parent" Object (e.g. GrandChild needs to refer it's parent which is an instance of Child and so on) (Down to a much deeper Level than indicated above.

Assume that the entity classes all have a property called parent or owner and I would like to get this one filled during DeSerializing the xml document, is it possible to "hook into" the serializer from the parameterless constructor or something like that to set the owner/parent Properties ?





Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>