0 Replies Latest reply on Nov 2, 2012 4:10 AM by JohnDevlon

    [AS][CS4] How to get XML element of grep find result?

    JohnDevlon Level 1



      Does anyone know how to get the xml element of a grep find result?


      I have multiple text frames, each containing multiple paragraphs. Each paragraph can contain one or more different xml tagged pieces of text.

      Using a simple search function I can locate the text I need, but how do I retreive the xml element applied to that piece of text.


      Using the "associated XML element" property, it doesn't work.

      set find what of find grep preferences to "€( )*(\\d)*"

      tell active document

                set myResult to find grep

                set myItem to item 1 of myResult

                set myElement to associated XML element of myItem

                -- The last line throws an error

      end tell


      The find result will return a collection of text objects.