建立 infoset

現在我們已經從內容檔案定義 topics,我們將建立 infoset。 資訊集 (infoset) 是文件 Web 或書籍。平台可以顯示任何數目的 infosets。

一個 infoset 包含一個或多個 infoview。 在 infoset 內 infoview 提供高階語意分組。 您可以使用 infoviews 在文件 Web 建立多重檢視畫面。 例如,我們可以使用它們建立文件(由許多元件提供)的整合檢視畫面。我 們也可以使用 infoviews 建立不同說明 topic 的個別檢視畫面。或(我 們即將執行)我們可以建立一個 infoview 顯示所有說明 topic。 使用術語 infoview 來避免與平台的使用者介面中的術語 view 發生 衝突/混淆。

每一個 infoview 包含 topics 的集成。有時候高階元件或產品團隊負責組合由一些它的元件團隊提供的文件和 topics。 現在我們假設外掛程式應該提供 topics 和整合 topics 的書籍 (book)。

下列 infoset 有 ID infoset_SampleGuide 並宣告其 ID 是 view_Contents 的 infoview。 當我們開始包括 infoview 的高階結構時,infoview 的 ID 會變得重要,最終會包 括先前定義的 topics。

infoset_SampleGuide.xml

<infoset id="infoset_SampleGuide" label="Online Help Sample" href="doc/splash.html">

 <infoview label="Content" id="view_Contents" />

</infoset>

使用者選取名稱為 "Online Help Sample" 的 book 時,他/她會看到 一個名稱是 "Content" 的可能 infoview。 也會顯示併入 splash.html 的歡迎頁面。

最上層佈線

現在我們需要定義使用者在 "Contents" infoview 內會看到的最上層結 構。 由為最上層 topics 建立下列 topics 檔案開始:

topics_view_Contents.xml

<topics id="topics_view_Contents">

 <topic id="conceptsRoot" label="Concepts" />

 <topic id="tasksRoot" label="Tasks" />

 <topic id="funRoot" label="Fun Things" />

 <topic id="refRoot" label="Reference" />

</topics>

在我們需要將這些 topics「包括」到 "Contents" infoview。 完成上述作業之後我們可以在上述最上層 topics 下面繼續包括其他 topics。 我們使用下列 actions 檔包括最上層 topics。

actions_view_Contents.xml

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

 <insert

 from="com.example.helpexample.topics_view_Contents"

 to="com.example.helpexample.view_Contents"

 as="child"/>

</actions>

上述 topics 檔中的 topics 元素 "topics_view_Contents" 的完整 topic ID 是 com.example.helpexample.topics_view_Contents。 在上述 actions 檔案中我們選取這個 topics 元素,將它包括到含有 ID com.example.helpexample.view_Contents 的 infoview。

下圖顯示 infoset(線上說明範例)的外觀作為包括這些最上層 topics 的結果。 infoset 的標題(標籤)只顯示在組合框(如果有一個以上的 infoset)。