dita-ot / org.dita.eclipsehelp

Eclipse Help plug-in for DITA-OT
Apache License 2.0
0 stars 0 forks source link

dita.out.map.htmlhelp.hhk fails to parse maps with <index-see> and <index-see-also> #1

Open jomjohn opened 12 years ago

jomjohn commented 12 years ago

Here is what the error looks like:

[pipeline] [DOTJ013E][ERROR] Failed to parse the referenced file 'GUID-BCAB1F51-5649-4181-90C3-FD4B35940FF0.ditamap'. The XML parser reported the following error:
[pipeline] org.dita.dost.index.TopicrefElement cannot be cast to org.dita.dost.index.IndexTerm
[pipeline] [DOTJ013E][ERROR] Failed to parse the referenced file 'GUID-1533C78F-50B5-425F-879F-EC518291FDF7.ditamap'. The XML parser reported the following error:
[pipeline] org.dita.dost.index.TopicrefElement cannot be cast to org.dita.dost.index.IndexTerm
[pipeline] [DOTJ013E][ERROR] Failed to parse the referenced file 'GUID-46A3E1DF-F0C4-4911-8F4D-CF1DE4FE140F.ditamap'. The XML parser reported the following error:
[pipeline] org.dita.dost.index.TopicrefElement cannot be cast to org.dita.dost.index.IndexTerm

The following instances result in the dita.out.map.htmlhelp.hhp target not parsing files:

Thanks for all of your help!

-Josh Johnson

robander commented 8 years ago

Verified that this still exists in 2.2.4, with the index parser in general (fails both for HTML Help and Eclipse).

I've updated the old hierarchy.ditamap sample, adding terms into the first branch:

<topicref href="tasks/garagetaskoverview.xml" type="concept">
  <topicmeta>
    <keywords>
      <indexterm>FUZZY</indexterm>
      <indexterm>frizzy<index-see>FUZZY</index-see></indexterm>
    </keywords>
  </topicmeta>
  <topicref href="tasks/changingtheoil.xml" type="task"/>
...

When I build that map to Eclipse, the log contains:

dita.out.map.eclipse.index:
     [echo]  args.eclipsehelp.indexsee = false
 [pipeline] [DOTJ013E][ERROR] Failed to parse the referenced file 'hierarchy.ditamap'.

When I build HTML Help, the log contains:

dita.map.htmlhelp.hhk:
 [pipeline] [DOTJ013E][ERROR] Failed to parse the referenced file 'hierarchy.ditamap'.

In both cases, if I remove the term with the nested <index-see>, the build completes without error DOTJ013E.

robander commented 6 years ago

At this point, with the bug report over 5 years old, I'm skeptical that support for <index-see> or <index-see-also> are going to be added to the older HTML Help and Eclipse output formats. I wonder if at this point it would be enough to ignore them, or possibly add support that doesn't have fancy formatting or attempt to link, rather than having good linking support for see/see-also.

lief-erickson commented 5 years ago

I ran into this issue for PDF2/FOP while trying to index the DITA-OT docs, too.

Edit: Used DITA-OT 3.3.1.

robander commented 5 years ago

I'm getting a new / different failure for Eclipse output now in 3.3.1 based on <index-see> - but it comes from Eclipse specific code. I don't get the same error in HTML Help (which uses a lot of the same code); I don't think any of that code is used for PDF.

For Eclipse in 3.3.1, having exactly the same index-see in two different topics causes the failure -- if two topics each contain this it will fail:

<indexterm>this<index-see>that</index-see></indexterm>
<indexterm>that</indexterm>

The failure in Eclipse comes from this line, though should probably be addressed earlier so that we never get here: https://github.com/dita-ot/dita-ot/blob/develop/src/main/plugins/org.dita.eclipsehelp/src/main/java/org/dita/dost/writer/EclipseIndexWriter.java#L233

When there are 2 identical index-see, we go into a for-loop with a two item list. The list is updated at that line, replaced with a list of children (list size 0). But we continue with the original for-loop, trying to get the second item in the original list, and end up with an "index out of bounds exception" because we're trying to access the second item in a zero-item list.

I'm guessing this should be addressed earlier to ensure that we don't actually have two child items (with topic links) for the index-see but I haven't worked out yet where to do that.