2 Replies Latest reply on Oct 27, 2011 12:28 PM by T_Stevens

    [js][cs5] Tagging text

    T_Stevens Level 1

      I'm new to scripting in InDesign and am having trouble applying xml tags to text. Specifically I need to target whitespace characters (hard and soft returns), and tag them separately from the main text. I've started by trying to simply tag any text using the following code snippet:


      app.selection[0].associatedXMLElements[0].markupTag=myDoc.xmlTags.item ("TEST");


      but this doesn't work since my text isn't already tagged. I get an error saying that the 'associatedXMLElements' is undefined.

      If I tag the text first it switches the tag, but I need to be able to tag previously untagged text as well.


      Any suggestions or help?