IWriteMetadataAndBlobPlugin - BlobSetXmlNode
Sets the text of all the XML nodes (elements or attributes) specified in the OnNodeXPath parameter to the given value. When the nodes or attributes do not exist, they are created. When the nodes already contain text, the OverWrite parameter will allow to overwrite or not.
Plugin Configuration
| Parameter | Required | Default value | Allowed values | Description |
|---|---|---|---|---|
| OnNodeXPath | Yes | XPath expression to select all nodes that have to be processed by the plugin | ||
| NodeType | Yes | node, attribute | The type of the node to set or to create as a child of the nodes found by the XPath expression in OnNodeXPath | |
| NodeName | Yes | The name of the node to set or to create as a child of the nodes found by the XPath expression in OnNodeXPath | ||
| OverwriteExisting | Yes | Specifies what happens if the node with NodeName already exists and has text. When the value is 'No', non-empty texts are not overwritten. When 'Yes', the text is overwritten | ||
| Value | Yes | One of the following can be used to specify the value:
| The value that will be set for the node |
plugin name="SETMASTERORMAPID" example
<plugin name="SETMASTERORMAPID" handler="BlobSetXmlNode"
ishcondition="CurrentAction in ('Create', 'Update', 'Checkin') and (EDT='EDTXML')">
<description>Set the id in the master, module or library the same as the DocId provided via metadata, if the id is not there already</description>
<initialize>
<parameters>
<parameter name="OnNodeXPath">
(/*[contains(@class,' map/map ')]) | (/*[contains(@class,' topic/topic ')]) | (dita)
</parameter>
<parameter name="NodeType">attribute</parameter>
<parameter name="NodeName">id</parameter>
<parameter name="OverwriteExisting">Yes</parameter>
<parameter name="Value">
<value type="Parameter">DocID</value>
</parameter>
</parameters>
</initialize>
</plugin>
Plugin flow
The plugin will first execute the XPath expression specified in OnNodeXPath.
- When NodeType="attribute" -> An xpath with "./@<NodeName>" is used.
- When NodeType="node" -> An xpath with "./<NodeName>" is used.
For every node the text is set (only when text is empty or OverwriteExisting="Yes") or a new node with the text is created with the value taken from the metadata/parameter or a newly generated GUID or Base62.