XML
has a tree structure (nested tags). Your objects are connected as a graph (that is, with cycles).
You'll have to visit the graph, find the cycles and open them up by clipping the references. Once you obtain the spanning tree of the graph, you can serialize that.
But the clipped references will be lost. So you will want to store the clipped references to, besides the spanning tree.
Upon deserialization you'll want to deserialize the spanning tree and then the additional references that were clipped. So you'll rebuilt those references by re-establishing them between the objects.
If you can, try to avoid cycles in your graph by reducing it to the spanning tree already in there definition. This way you'll not have to do all that work just to serialize it.
On the other hand, removing those references may impact on the rest of the application, so you may not want to do that.
On another note: a well designed database has a normal form (often the third but there are others, too). Those concepts are pretty much related to one another.
This is a rough pseudo-C# guide:
xml = serialize(root)
{
1. set all parents to null
2. XML serialize
3. rebuilt all parents <-- reuse rebuiltParents()
}
root = deserialize(xml)
{
1. XML deserialize
2. rebuilt all parents <-- reuse rebuiltParents()
}