布线操作

操作文件包含要对主题和信息视图执行的脚本编制操作。目前只有一种操作 — 插入操作, 可以使用此操作来将主题插入到信息视图中称为插入点的指定位置。信息视图和主题都可以用作插入点。只有定义可选标识的主题才能用作插入点。(信息视图必须始终具有标识)。

当定义插入操作时,目标属性指定目标插入点。在属性中指定的主题是要插入的主题。

以下是一些可以用来插入主题的方法:

插入操作可以嵌套,以定义“备用”插入操作, 如果父插入操作失败,就应执行该“备用”插入操作。当插入点位于可能安装也可能未安装的其他插件中时,这就很有用。可以将主题插入到另一个插件的主题中,而如果插入操作失败(因为没有安装其他插件), 则可以将该主题安装到其他地方。 一旦满足插入点,就会忽略嵌套的插入操作。

操作文件始终将它们的操作应用于单个信息视图。如果想要将主题安排到不同的信息视图中, 则每个信息视图都将需要操作文件。一个主题在特定的信息视图中可能只使用一次。 如果需要在一个信息视图中引用某个主题两次, 则将需要创建使用相同标号href 的另一个主题元素(不同的标识)。

集成主题

现在,应该执行最后一个步骤,就是将我们的主题集成到“内容”信息视图的顶级主题中。为此,需要另一个操作文件,我们将其称为 actions_All.xml(因为它集成了我们的所有主题)。

actions_All.xml

<actions infoview="com.example.helpexample.view_Contents">

 <insert

     from="com.example.helpexample.conceptsAll"

     to="com.example.helpexample.conceptsRoot"

     as="child"/>

 <insert

     from="com.example.helpexample.refAll"

     to="com.example.helpexample.refRoot"

     as="child"/>

 <insert

     from="com.example.helpexample.plainTasks"

     to="com.example.helpexample.tasksRoot"

     as="child"/>

 <insert

     from="com.example.helpexample.funTasks"

     to="com.example.helpexample.funRoot"

     as="child"/> </actions>

记住,我们有一些与任务有关的 HTML 文件, 而这些文件的结构/导航是由 topics_tasks.xml 定义的,如下所示:

topics_tasks.xml

<topics id="tasksAll">

 <topic id="plainTasks" label="Plain Stuff">

     <topic label="Task1" href="doc/tasks/task1.html"/>

     <topic label="Task2" href="doc/tasks/task2.html"/>

 </topic>

 <topic id="funTasks" label="Fun Stuff" >

     <topic label="Task3_1" href="doc/tasks/task3_1.html"/>

     <topic label="Task3_2" href="doc/tasks/task3_2.html"/>

 </topic>

</topics>

在以上操作文件中, 我们将插入用作子操作来获取标识为 com.example.helpexample.plainTasks 的主题, 并将它及其副主题插入到标识为 com.example.helpexample..tasksRoot 的主题下面

<insert

     from="com.example.helpexample.plainTasks"

     to="com.example.helpexample.tasksRoot"

     as="child"/>

操作文件还执行一些更有趣的任务, 并使用以下操作来将它们插入到 Web 的“有趣的事情”区域中。

<insert

     from="com.example.helpexample.funTasks"

     to="com.example.helpexample.funRoot"

     as="child"/>