<instance> 元素
<instance> 元素是 <sbom> 元素的子元素。<sbom> 元素可以包含任何數目的 <instance> 元素,或者可以是空的。sBOM <instance> 可以參考 eBOM 中的來源項目,或者可以只存在於 sBOM 中。
sBOM 樹中的每個節點都有一個 <instance> 元素。每個 <instance> 都代表特殊服務狀態的 sBOM 中的一或多個零件。可以將它們巢狀階層排列以建立 sBOM 樹結構。
<instance> 的屬性與子項會為 sBOM 中的零件進行服務資訊編碼。例如,它們可以傳遞有關 sBOM 零件的以下資訊:
零件名稱
零件編號
是否在 eBOM 中參考 sBOM 零件
零件是否已分項而且可更換
零件是預裝配發貨還是在套件中
當 sBOM 中的零件的服務資訊變更時,您可以編輯 sBOM 的 <instance> 元素。舉例來說,您可以在 <instance> 元素本身新增、移除 (隱藏) 或變更屬性值,或是變更其子元素的值。
<instance> 語法
<instance type="FOLDER" qty="1">
<name />
<ebom />
<attribute name="" />
<attribute name="" />
...
<attribute name="" />
<instance />
<instance />
...
<instance />
</instance>
<instance> 屬性
type
指定實例類型:
FOLDER
預設的實例類型。
REPLACEABLE
實例是有效、可使用、分項的零件。
COLLAPSED
實例與其父節點合併。此實例不可分項。
PREASSEMBLED
實例為以單一裝置提供服務的零件組。此實例的父節點為 type="REPLACEABLE"。根據預設,此實例的所有子項皆為 type="COLLAPSED"
qty
指定要建立的實例的數目 (數量)。預設值 (如果省略) 為 1。
<instance> 子元素
<name>
此實例的選用自由形式文字名稱。
<ebom>
請參閱<ebom> 元素
<attribute>
<instance> 可以包含零或多個子 attribute 元素。attribute 元素中的屬性值會取代任何參考 eBOM 節點中的值。它們也可以將新的屬性新增到 sBOM 實例中。
<instance>
<instance> 可以包含零或多個子 <instance> 元素。舉例來說,組件節點的 <instance> 元素可以在組件的每個零件中包含一個子 <instance> 元素。
<instance> 範例 1
此範例會顯示如何使用 <name>attribute 子元素,為實例指定一個顯示名稱、指定新的唯 sBOM 屬性,以及如何隱藏 (刪除) 屬性。
<sbom>
<instance>
<!-- assign a display name -->
<name>my sbom instance</name>
<!-- include a new attribute on the sBOM instance -->
<attribute name="PartNo" type="symbol" category=“custom”>123-4567</attribute>
<!-- hide (delete) an attribute from an instance -->
<attribute name="Designer" type="symbol" category="PROE Parameters" hidden="true"/>
<instance> 範例 2
這個範例會顯示如何以階層定義實例。組件實例的範例顯示於下方。如果實例會參考同樣是組件的 eBOM 項目,則該組件的整個內容會產生而成為子 <instance> 元素。
<instance qty="1" type="PREASSEMBLED">
<name>tree </name>
<!-- The copyasm=true flag specifies that the entire ebom instance
and all children should be copied across -->
<ebom copyasm="true">
<refpart name=“CustomId” category=" id-db " type="symbol">321-7654</refpart>
</ebom>
<!-- Any instances declared inside this assembly instance (above)
override the items that were copied over as part of the parent
operation. In this case, this specified reference instance has
been given a specific display name and assigned the
REPLACEABLE type.-->
<instance qty="1" type="REPLACEABLE">
<name>replacable child </name>
<ebom>
<refpart name=“CustomId” category=" id-db " type="symbol">432-8765</refpart>
</ebom>
</instance>
</instance>
如同上方所示,type="PREASSEMBLED" 項目會指定從 eBOM 複製的組件,並且保持結構完整。其所有子項會標示為已組合 (即 type="COLLAPSED")。XML 中的任何子項定義將會改變在父項動作建立的 sBOM。在上面的範例中,我們透過屬性比對發現其中一個項目。如果我們變更它的 <name>,也會將它的 type 變更為 REPLACEABLE (即非 COLLAPSED)。
<instance> 範例 3
此範例顯示預設的實例 type="FOLDER"。會建立名為「螺栓」的資料夾實例。它包含了名為 BOLT 代表 12 顆螺栓的子實例 (qty="12")。
<instance type=”FOLDER”>
<name>bolts</name>
<instance qty="12" type="REPLACEABLE">
<name>BOLT</name>
<ebom>
<refpart name=“CustomId” category=" id-db " type="string">ab-3344</refpart>
</ebom>
<property name="PartNo" type="symbol" category=“custom”> 789-3344</property>
</instance>
這是否有幫助?