Loading...
 

Plugin XMLUPDATE

Introduced in Tiki15 and backported to Tiki 12.5 and Tiki14.2

Use this wiki plugin to easily update selected, multiple elements of an XML file stored in a File Gallery, by using a form in the wiki page.

This plugin was originally developed so that Tiki managed 'control' XML files could be downloaded by multiple Raspberry Pi's that are used for data collection and other IoT purposes, and where the updating of individual elements of the control file could be delegated to individual Tiki users.

Many other uses will however be possible.

XML file requirements


The XML file is stored in a File Gallery and File Galleries must (at present) use the option to store all files in a Directory.

The XML file must also be a simple structure that does not repeat any of the node names as names are searched for irrespective of what 'level' they are at.

The following file is used as a worked example in this documentation:

Copy to clipboard
pitiki01 no 07:00 22:30 no 4 kitchen_image 5 1 /home/pi/pirepo_cookies/ pitiki01-cookies.txt 300 1800

Parameters

Allows multiple elements of an XML file stored in a File Gallery to be updated - the File Gallery (at present) is assumed to store all files in a Directory.
Introduced in Tiki 15. Required parameters are in bold.
Go to the source code
Preferences required: wikiplugin_xmlupdate

Parameters Accepted Values Description Default Since
(body of plugin) list (one per line) of the XML element (node) names irrespective of their path and must (at present) be unique in the file
fileId digits File Id of the XML file stored in a File Gallery which is assumed to store its data in a directory 15.0
attribute text optional use of an attribute for the XML nodes - used as a label in the input form. If used then all nodes in the XML file should have the attribute text set even if it is a blank/space 15.0
namelisted yes
no
yes/no option to include the XML node name in the plugin output - default is yes - and should always be yes if the attribute parameter is not used or not all the nodes have their attribute text set yes 15.0

Example


The following is the code for the worked example:

Copy to clipboard
{XMLUPDATE(fileId="1281" attribute="description" namelisted="yes")} servername notinXMLfile downloadXMLfileId downloadXMLinterval {XMLUPDATE}

As you can see the node names that are being updated are simply listed in the plugin body, and as illustrated in this example, blank lines are ignored and any node names that are not in the XML file will be flagged as 'not found'.

The resulting output screen shot from this example is below

XMLUPDATE Tiki Example


The output format for the form includes the text just above the form which confirms the number of node names being considered and provides basic text for what to do.

The form is structured as a table and depending upon what theme is being used some padding may need to be applied to the table cells to make the form look 'nice'.




List Slides