Download the SDK. There is somewhere within it a folder of sample scripts that show how to manipulate a document's xml structure.
Thanks, I have already done.
But I have not found enought info on solving my problems.
This is why I am looking here for an help.
I think the MoveXMLElement.jsx script there shows pretty well what's involved. Here's something that addresses something closer to your example:
var root = app.activeDocument.xmlElements; root.xmlElements.item("tag1").move(LocationOptions.AT_END, root.xmlElements.item("section")); root.xmlElements.item("tag2").move(LocationOptions.AT_END, root.xmlElements.item("section")); root.xmlElements.item("tag3").move(LocationOptions.AT_END, root.xmlElements.item("section"));
You want to be careful about the order you do things and when you grab references to the xml structure objects, since you're changing them as you go (i.e. root.xmlElements might refer to tag3 when you start, but will be invalid once you start moving things into section).
If the xml structure in your InDesign document is the result of an xml import, you might consider transforming the xml as you import it. It's faster and more natural there.
Hope that helps,
This is a bit clumsy but maybe you get the idea:
var root=app.activeDocument.xmlElements;//"real" Root
Could some one please let me know if i can add a new xmlTag between to existed xmlTags using insertionPoints ?
A textFrame is holding two tags ,
now i would like to place Tag3 between this two tags in the same textFrame.