1 Reply Latest reply on Apr 14, 2011 1:37 PM by John Hawkinson

    [JS CS5] Apply XmlTag to text selection

    JohnDevlon

      Hi,

       

      Does anyone know how you can apply a XmlTag to a text selection? Currently I tried ...

       

       

                if (app.selection[0].constructor.name == "Text"){                                   
                                         
                                          var myXMLroot = myDoc.xmlElements.item(0);
                                          var myElement = myXMLroot.xmlElements.add( "TagName");

                                          // Doesn't work

                                          myElement.placeXML(app.selection[0]);

                                          // Doesn't work
                                          app.selection[0].markup = myElement;

                }

       

      What if the parent text frame has no tag applied?

       

      Any help would be great.

       

      Kind regards