Assigning Map IDs to Help Topics

The map file associates each help-topic map ID with the URL of a help topic HTML file. The map ID acts as a nickname for the file; the TOC file, index file, and word-search index file all use these nicknames to specify help topics.

In Chapter 1, I showed you how a map file works within a HelpSet. In this section I expand on the map file by explaining how you create, edit, and structure it.

The Map File

Take a look at the map file, Map.jhm, for the Aviation JavaHelp sample. A portion of the contents are shown here:

<?xml version='1.0' encoding='ISO-8859-1' ?>
<!DOCTYPE map
  PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp Map Version 1.0//EN"
         "http://java.sun.com/products/javahelp/map_1_0.dtd">

<map version="1.0">
  <mapID target="toplevelfolder" url="Images/toplevel.gif"/>
  <mapID target="intro" url="Topics/introduction_to_aviation.htm"/>
  <mapID target="aerodynamics" url="Topics/Aerodynamics/aerodynamics.htm"/>
  <mapID target="drag" url="Topics/Aerodynamics/drag.htm"/>
  <mapID target="lift" url="Topics/Aerodynamics/lift.htm"/>
  <mapID target="thrust" url="Topics/Aerodynamics/thrust.htm"/>
  <mapID target="weight" url="Topics/Aerodynamics/weight.htm"/>
</map>

As in the HelpSet file, the XML declaration (<?xml ...) and the document type definition (<!DOCTYPE ...) are optional. The root element of the map file is named “map,” specified with the <map> and </map> tags. The <map> start-tag includes an optional version attribute, where you can specify the JavaHelp ...

Get Creating Effective JavaHelp now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.