Skip to main content
Participant
February 13, 2008
Answered

Active xmlElement

  • February 13, 2008
  • 2 replies
  • 392 views
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
This topic has been closed for replies.
Correct answer srakete
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 replies

Participant
February 13, 2008
thx :) that did the job
srakete
sraketeCorrect answer
Inspiring
February 13, 2008
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