Skip to main content
Known Participant
February 22, 2012
Answered

How to Get a List of All XMLElement Tags

  • February 22, 2012
  • 1 reply
  • 889 views

(CS5, Win7, 64Bit)

I need a list of all the unique XML Tag names in a given document (just like the Tags Panel in InDesign itself).

I could not find any "normal" way (i.e., builtin-in property or method) to get at the information. Instead, I found that I had to recurse through the entire XMLElement tree, starting with the Root Element. For a large document, this can take close to a quarter of an hour, and sometimes I have to do this for an InDesgin Book containing over ten enormous INDD files.

There HAS to be a better way, right?

Would it be better were I to recurse through all PageItems in the document and then recurse through each PageItem's XMLElement tree? I assume that wouldn't make a big difference wither way.

I'm open to suggestions...

TIA,

mlavie

This topic has been closed for replies.
Correct answer கற_பன___Imagine_

Try this,

$.writeln(app.activeDocument.xmlTags.everyItem().name);

1 reply

கற_பன___Imagine_
Inspiring
February 22, 2012

Try this,

$.writeln(app.activeDocument.xmlTags.everyItem().name);

mlavieAuthor
Known Participant
February 22, 2012

Thanks கற்பனை,

I can't believe I missed that. But I am about to post a follow-up question,

By the way, are you Tamil - or just a Lennon fan?

mlavie

கற_பன___Imagine_
Inspiring
February 22, 2012

mlavie wrote:

By the way, are you Tamil - or just a Lennon fan?

my mother language is tamil, I'm proud to say tamilan,  It's my forum user name ...