The question is not clear, but it's quite possible that you need XML
serialization:
https://en.wikipedia.org/wiki/Serialization[
^].
Well, before trying to deserialize some
object graph from XML, you have to take care about proper serialization of that graph in first place; serialization should be a consistent two-way process, developed accordingly. See, in particular, this open-source project:
http://simple.sourceforge.net[
^].
—SA