Loading...
 
Skip to main content

History: PluginXMLUpdate

Source of version: 10 (current)

Copy to clipboard
            ! 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:
{CODE()}
<?xml version="1.0"?>
<management>
	<servername description="the host name of the Pi server">pitiki01</servername>
	<control description="">
		<stopimaging description="">no</stopimaging>
		<starttime description="">07:00</starttime>
		<stoptime description="">22:30</stoptime>
		<suspendimaging description="">no</suspendimaging>
	</control>	
	<sitedata description="">
		<uploadgallery description="">4</uploadgallery>
		<uploadname description="">kitchen_image</uploadname>
		<downloadgallery description="">5</downloadgallery>
		<downloadXMLfileId description="tiki fileId for the XML file">1</downloadXMLfileId>
		<cookiepath description="">/home/pi/pirepo_cookies/</cookiepath>
		<cookiefile description="">pitiki01-cookies.txt</cookiefile>
	</sitedata>
	<intervals description="">
		<uploadinterval description="">300</uploadinterval>
		<downloadXMLinterval description="">1800</downloadXMLinterval>
	</intervals>
</management>
{CODE}
!!Parameters
{pluginmanager plugin="xmlupdate"}
!! Example

The following is the code for the worked example:
{CODE()}
{XMLUPDATE(fileId="1281" attribute="description" namelisted="yes")}
servername

notinXMLfile

downloadXMLfileId
downloadXMLinterval

{XMLUPDATE}
{CODE}
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

::{img fileId="1282"}::

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'.




~tc~ (alias(Plugin XMLUPDATE)) ~/tc~