3. 创建
Map 文件
在读取 helpset 文件之后,JavaHelp 系统就会读取在 helpset 中所列出的 map
文件。map 文件使用 URL 将主题 ID 和 HTML 主题文件的路径联系起来。示例代码 3 显示了一个 map
文件示例:
示例代码 3: Map.jhm
<?xml version='1.0' encoding='ISO-8859-1' ?>
<!DOCTYPE map
PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp Map Version 1.0//EN"
"https://java.sun.com/products/javahelp/map_1_0.dtd">
<map version="1.0">
<mapID target="toplevelfolder" url="images/toplevel.gif" />
<mapID target="top" url="help/welcome.html" />
<mapID target="intro" url="help/welcome.html" />
<mapID target="start" url="help/start.html" />
<mapID target="overview" url="help/welcome.html" />
<mapID target="one" url="help/start.html" />
<mapID target="two" url="help/start.html" />
<mapID target="bean.story" url="help/welcome.html" />
<mapID target="bean.story" url="help/start.html" />
<mapID target="bean.story" url="help/welcome.html" />
</map>
4.
创建目录(TOC)文件
目录文件描述了将显示在目录导航器中的目录以及目录的布局。目录文件的示例请参见示例代码 4。
示例代码 4: SampleTOC.xml
<?xml version='1.0' encoding='ISO-8859-1' ?>
<!DOCTYPE toc
PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp TOC Version 2.0//EN"
"../dtd/toc_2_0.dtd">
<toc version="2.0">
<tocitem text="My Sample Help" image="toplevelfolder">
<tocitem text="Introduction to Sample Online Help" target="intro"/>
<tocitem text="Tutorial" target="start" expand="true">
<tocitem text="Welcome" target="overview"/>
<tocitem text="Tutorial One: Help One" target="one"/>
<tocitem text="Tutorial Two: Help Two" target="two"/>
</tocitem>
<tocitem text="Beans In IDE" target="bean.story"/>
<tocitem text="Beans In IDE - in SecondaryWindow" target="bean.story" //
presentationtype="javax.help.SecondaryWindow" presentationname="main"/>
<tocitem text="Beans In IDE - in Popup" target="bean.story"
presentationtype="javax.help.Popup"/>
</tocitem>
</toc>
示例目录的运行结果如图 2 所示。
(责任编辑:luwei) |