此檔案的結構由一個 header 元素及一個以上的 step-type 元素組成。header 元素識別外掛程式。每一個 step-type 元素都定義一個步驟。這些步驟可供使用者在程序編輯器中使用,並且用於建構元件程序。
宣告文件類型之後,plugin 根元素會識別所有外掛程式都使用的 XML 綱目類型 PluginXMLSchema_v1.xsd。下列程式碼範例呈現了自動化外掛程式之 plugin.xml 檔的基本結構:
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://www.urbancode.com/PluginXMLSchema_v1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<header>
<identifier id="plugin_id" version="version_number" name="Plug-in Name"/>
<description/>
<tag>Plugin type/Plugin subtype/Plugin name</tag>
</header>
<step-type name="Step_Name">
<description/>
<properties>
<property name="property_name" required="true">
<property-ui type="textBox" label="Driver Jar"
description="The full path to the jdbc driver jar to use."
default-value="${p:resource/sqlJdbc/jdbcJar}"/>
</property>
</properties>
<post-processing>
<![CDATA[
if (properties.get("exitCode") != 0) {
properties.put("Status", "Failure");
}
else {
properties.put("Status", "Success");
}
]]>
</post-processing>
<command program="${path_to_tool">
<arg value="parameters_passed_to_tool"/>
<arg path="${p:jdbcJar}"/>
<arg file="command_to_run"/>
<arg file="${PLUGIN_INPUT_PROPS}"/>
<arg file="${PLUGIN_OUTPUT_PROPS}"/>
</command>
</step-type>
</plugin>
<tag>MyPlugins/PluginA</tag>
安裝外掛程式時,步驟會出現在選用區內指定的資料夾中,如下圖中所示。
<step-type name="Step one">
<server:sub-tag>Subgroup1</server:sub-tag>
<plugin xmlns="http://www.urbancode.com/PluginXMLSchema_v1"
xmlns:server="http://www.urbancode.com/PluginServerXMLSchema_v1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
如需來源外掛程式之 plugin.xml 結構的相關資訊,請參閱建立來源外掛程式。