XML File Writer
Description
The XML File writer plugin writes a 1Gateway message as XML content in a file and optionally stores the file on an ftp server. The XML content can have a header to include at the beginning of the file.
Prerequisites
- Give read/write permissions to the directory path configured in the plugin
Installation
Make sure you have the 1gateway zip file that includes the plugin files and valid licences information ready. This file has been provided to you with the installation files.
1 - Login
Login to 1gateway, and make sure you are in "Advanced mode". If this is the first time you log in, the default user and password are both 'admin' (without the quotes).
2 - System Maintenance
Click on the menu icon and choose the option "System maintenance"
3 - Upload file
In the System maintenance view you can either drag and drop the downloaded zip file or select it by clicking the "choose file" button.
4 - Restart
After the upload installation will be confirmed. Restart 1Gateway to ensure any locked files are updated.
Configuration
Open the main menu and click on "New plugin"
Select the plugin you want to configure. Use the Filter field if needed.
Field name | Supported values | Description |
---|---|---|
Path to files | Any string | Defines the directory which to write to |
Filename prefix | Any string | Defines the filename or prefix of the filename to write. See below for mode information |
Erase file content on first write | true / false | Indicates if to replace the file if it already exists |
Root key from which to start writing from | Any string | Defines a key in the message which acts as the root element of the XML |
XML header | Any XML string | (Optional) Defines the header to write at the beginning of the XML file |
Include attachment in output XML | true / false | Indicates if to include an attachment key with the message attachment content |
The location to which to write the file is saved is always the path defined. The path can indicate a subdirectory by including a / (slash) in the "Path to files" field in the plugin.
The filename will be taken from the 1GatewayHeader/filename key in the message if it exists.
If it doesn't, the filename will be [Filename prefix field from plugin}-[1GatewayHeader/origin/id field from message]-[Current time in ms].xml
FTP options:
To distinguish between XML attributes and elements in the message, put an @ (at) sign at the beginning of the key name to define XML attributes and don't include an @ (at) sign to define XML elements when defining the keys of a message in the mapper. If a XML element has both attributes and a text value, the text value is indicated with a subkey called "TEXT_CONTENT".
For example, the following mapper will give this XML as result:
<?xml version="1.0" encoding="UTF-8"?>
<payload>
<message type="incident">
This is an incident
</message>
<status>
new
</status>
<customer id="DD001">
<name>
Donald Duck
</name>
<email>
donald@duck.es
</email>
</customer>
</payload>