Thank you very much for your reply,
This is indeed an interesting approach to the issue, but for this specific flow we want to be able to do it with ExtendScript by displaying a form, requesting some input from the user and then building the xml structure.