XSD with multiple object types

I need an example for how to write an XSD files which contains different related object types. In particular, I need an example which shows a self (or circular) reference. Specifically, how do I write my XSD file so that my DomainToXMLmapping will export object keys so they can be related to other objects?
1 answers

I got this working but it was incredibly convoluted. I made four new fields in my entity:

id (autonumber)

parent_id (calculated value referencing id)

id_temp (integer)

parentidtemp (integer)

When I export, id and parent_id go into the XML (via the domain to xml mapping)

When I import, that data goes in the temporary fields. Then I use a microflow to loop over the objects and use the temp data to reconfigure the relationships.

If anyone has a better idea let me know.