The SituationI have a complex model object graph in Java that needs to be translated back and forth into an XML document. The object graph structure of the XML document's schema is extremely different from the model's object tree. The two are interchangeable, but the translation requires lots of context-driven logic where parent/child-like relationships are used.The ProblemI'm working with model objects that are well established in a older system and the XML document's schema is fairly new. Since lots of our code depends on the structure of the model objects, we don't want to restructure them. Here is a simplified example of the type of structural differences I'm dealing with:\[quote\] Example data model tree Item
- Description
- cost
- ...
- First Name
- Last Name
- Address
- ...
- Street
- City
- ...
- Buyer (Person)
- Seller (Person)
- Sold Items[] (List)
- Exchanged Items[] (List)
- Location of Transaction (Address)
- Type
- Parties
- party_contact_ref type
- contact_id
- type
- total_amount_exchanged
- Item
- type
- owning_party_contact_ref_id
- exchange_use_type
- Contact
- id
- type