XML Records how to export child records as attributes

XML Records how to export child records as attributes

I've got entities company and employee. Obviously a company can have more than one employee.
I've got the employee entity linking to the company entity with a companyId.

When I use RecordToXml on the company entity I only get the company entity, not the employees.
I would like to have the employees listed as attributes within the xml for the company, such as:


How to do this in the easiest way?

Here's an OML that demonstrates the requirement....
I never got any help for this one and in fact many must have the problem. XML Records is not well documented and since it is such a helpful component it is really a pity.
In any case one way to do the above is:
- define structures with exactly the layout and attributes that you need in your XML
- then copy the relevant records into these structures
- the XML configuration parameters are best defined as an XML structure in itself, then converted into records with XmlToRecord
- the final XML output can be further modified with replace statements and by adding the surrounding XML tags

-- Claus