1 person found this helpful
I might suggest looking at XML Rules (starts on page 141 of the IDCS4 Scripting guide).
I did it that way for one project, it worked well and was reasonably fast. My code allowed multiple taxonomies in the index so was a bit too complex to put forth as an example. To simply scan for tags is pretty straightforward and well represented in the scripting guide.
Thanks for the reply, Bob. I looked into that and there are good examples of finding XML elements. I suppose the problem I'm having, though, is about selecting those elements and inserting them into the index. I'm trying to create the index and add the index entries. I tried to do it originally by finding all text with a certain paragraph style, but that included symbols, inadvertently. So I wanted to do something through XML rules, but when doing a find and replace, I can use the:
Set found_words = myDocument.FindText();
and then use
Set myIndex= myDocument.Indexes.Add()
to create the index and loop through the paragraphs to add entries to the index. I'm having trouble creating the index and finding a way to take the words and add them to the index, that's all.
You need to first add topics to the index and then add page references to the topics.
I'm using the following code to add the topic, but I have the feeling I'm missing something.
Set myIndex = myDocument.Indexes.Add()
Set myTopicName = myXMLElement.Texts.Item(1).Contents
Set myTopic = myIndex.Topics.Add(myTopicName)
This is VB rather than JS so I'm not 100% comfortable, but that looks right. Does the topic appear in the Index panel when you run that?
To get references though, you now need to add PageReference objects to the Topic.