2 Replies Latest reply on Feb 13, 2008 6:51 AM by (David_Houthoofdt)

    Active xmlElement

      Hello ,

      I've created some xml tags inside my document.But now i want to get the active xml tag inside my document.
      When you select the text in your document then you can see the active xml tag in the xml tree structure.

      Can you get that active tag in script?

      I've already tried my_doc.ActiveXMLElement and my_doc.ActiveXMLTag but they give me an error.

      Any ideas?

      Kind regards,

      david
        • 1. Re: Active xmlElement
          srakete Level 1
          David,

          suppose you have two textFrames tagged with Tag1 and Tag2. If you select one of these textframe you get the associated XmlElement like this:

          myFrame = app.selection[0];
          mySelectedXMLItem = myFrame.associatedXMLElement;
          myTag = mySelectedXMLItem.markupTag.name;
          alert(myTag);

          If you select text in a textFrame you need to look at the property
          associatedXMLElements (note the 's' at the end) of the paragraph or the character or whatever you have selected. This may give you
          an array of XMLItems. It depends on the structure of your Xml.

          Stefan
          • 2. Re: Active xmlElement
            Level 1
            thx :) that did the job