Copy grouped object and xml structure
Hi,
I Use either UXP or classic Extendscript, and want to do the following:
Duplicate a group of items that all has xml tags in this form:

- On the page there is an empty textframe tagged with <product>
- The textframe is tagged with <texts> and conatins two tags: <title> and <body>.
- the picture is located in a dummy tag <pics> and is tagged with <pic>.
All items is grouped and located on a master page.
With a script, I then want to:
- Duplicate the group.
- Move the items to a page in the document.
- Duplicate all tags in the structure, so they are identical, but directly under the Root.
Problem:
I end up with either just duplicating the structure, but then the reference to the items on the page is lost
OR
I end up with duplicating the items on the page, but then the tags does not move along with it, like in this picture, they get stuck in their original location. (Only the <product> tag and the dummy <pics> tag are moved. The rest is still in their original position in the structure.

If I use app.copy() the items and the structure is copied correctly. But this means I have to select the items with the script and then use copy. I would rather use duplicate.
So... duplicate is different from copy.
Is there a way to duplicate items and the xml structure?
