1 Reply Latest reply on Mar 30, 2011 6:35 AM by John Hawkinson

    Add parent Xml Element

    Kan7 Level 1

      Hi All,


      I have selected myElement. Then how to add new parent Element in indesign cs3 using Javascript.  pls suggest.




        • 1. Re: Add parent Xml Element
          John Hawkinson Level 5

          Well, you'll need to add a new element at the right place in the hierarchy, and then move myElement there.

          So something like (untested):


          var oldParent = myElement.parent;
          var newParent = oldParent.xmlElements.add(oldParent.tag);
          myElement.move(LocationOptions.AT_BEGINNING, newParent);


          But you don't specify what the new parent node should have or where it should be in the hierarchy, so there'll need to be some adjustment.