pCOWeb +030220966 – rel. 1.1 – 12.12.2017 22
4.3.2 Generation of the XML file
When a notification event occurs, pCOWeb can generate an XML file containing information on the pCOWeb and the values of the pCO variables, which can be sent
via FTP or as an e-mail attachment. XML (eXtended Markup Language) is a standard file format for conveying information organised in a diagram; it is recognised by
many types of software that manage data that is imported from files. This function is useful when the receiving computer uses one of these software applications.
INFORMATION
• pCOWeb generates the file using a templa te based on a special file th at must reside on the pCOWeb; as an example s ee “template.xml” included by
default and that can be edited by accessing the user memory via FTP (see 0 on page 25).
NOTE 1: A copy of the default file “template.xml” is available in read- only memory. To call the copy simply access pCOWeb using the FTP or SCP
protocol (see 0 on page 25) and get the file /usr/local/root/deftemplate.xml.
NOTE 2: WordPad should be used to edit the template in the Windows operating system: in fact, the pCOWeb files conform to the Linux s tandard, whic h
differs from Windows in terms of the different mana gement of the line break control characters; WordPad can import the Linux format and save in
Windows format, which can also be read by pCOWeb.
• When sending, pCOWeb will read the template selected i n the notific ation settings, and will proces s it based on some simple rules described fur ther on,
generating the new XML file to be sent.
HOW pCOWeb GENERATES THE XML FILE
pCOWeb reads the template file and copies it character-by -character to the destinatio n file; whenever it recognises a sequence of XML tags, such as in the
example shown below, it adds the corresponding information.
LINE IN TEMPLATE.XML MEANING LINE GENERATED IN XML FILE TO BE SENT
<?xml version = '1.0' encoding = 'UTF-8'?> Specifies the type of XML standard used <?xml version = '1.0' encoding = 'UTF-8'?>
<PCOWEB> The sequences of tags will only be recognised inside sections that start with this tag <PCOWEB>
<SYSTEM>
Start of the sect. with the sequ. of tags with pCOWeb properties (that is, not pCO)
<SYSTEM>
<HOSTNAME></HOSTNAME>
Returns the name of the pCOWeb – always “localhost”
<HOSTNAME>localhost</HOSTNAME>
<DATE></DATE> Returns date and time the file was generated, in the format YYYYMMDDHHMMSS <DATE>19700101064832</DATE>
<IP_ADDRESS></IP_ADDRESS>
Returns the IP address of the pCOWeb
<IP_ADDRESS>10.0.3.114</IP_ADDRESS>
<MAC_ADDRESS></MAC_ADDRESS>
Returns the MAC address of the pCOWeb
<MAC_ADDRESS>00:0a:5c:10:07:15</MAC_ADDRESS>
<UPTIME></UPTIME>
Returns the time elapsed since the last reboot of the pCOWeb
<UPTIME>0d2h42m</UPTIME>
<SYS_VERSION></SYS_VERSION>
Returns the firmware version of the pCOWeb (block B - Bios)
<SYS_VERSION>B2.0.4</SYS_VERSION>
<APP_VERSION></APP_VERSION>
Returns the firmware version of the pCOWeb (block A - Applications)
<APP_VERSION>A2.0.4</APP_VERSION>
<SEPARATOR_CHAR>.</SEPARATOR_CHAR> No action. Suggests the character that the XML interpreter can use as the separator
for the values of the analog variables
<SEPARATOR_CHAR>.</SEPARATOR_CHAR>
</SYSTEM>
End of the section with the sequ. of tags with pCOWeb properties (that is, not pCO)
</SYSTEM>
<PCO>
Start of the section with the sequences of tags with pCO properties
<PCO>
<PCONAME>Template Sample</PCONAME>
No action. Line used to assign a name to the specific pCO; in the example, the
name is “Template Sample”
<PCONAME>Template Sample</PCONAME>
<PCOID>1</PCOID>
No action. Line used to assign an identifier number to the specific pCO; in the
example, the number is “1”
<PCOID>1</PCOID>
<DIGITAL> Start of a section for digital variables <DIGITAL>
<VARIABLE> Start of the section for one digital variable <VARIABLE>
<INDEX>1</INDEX>
Specifies the index 1 for the variable to pCOWeb
<INDEX>1</INDEX>
<VALUE></VALUE>
pCOWeb returns the current value (0) of the digital variable with index 1
<VALUE>0</VALUE>
</VARIABLE> End of the section for the digital variable with index 1 </VARIABLE>
<VARIABLE> Start of the section for another digital variable <VARIABLE>
<INDEX>2</INDEX>
Specifies the index 2 for the variable to pCOWeb
<INDEX>2</INDEX>
<VALUE></VALUE>
pCOWeb returns the current value (1) of the digital variable with index 2
<VALUE>1</VALUE>
</VARIABLE> End of the section for the digital variable with index 2 </VARIABLE>
</DIGITAL> End of a section for digital variables </DIGITAL>
<INTEGER> Start of a section for integer variables <INTEGER>
<VARIABLE> Start of the section for an integer variable <VARIABLE>
<INDEX>1</INDEX>
Specifies the index 1 for the variable to pCOWeb
<INDEX>1</INDEX>
<VALUE></VALUE>
pCOWeb returns the current value (25) of the integer variable with index 1
<VALUE>25</VALUE>
</VARIABLE> End of the section of the integer variable with index 1 </VARIABLE>
<VARIABLE> Start of section for another integer variable <VARIABLE>
<INDEX>2</INDEX>
Specifies the index 2 for the variable to pCOWeb
<INDEX>2</INDEX>
<VALUE></VALUE>
pCOWeb returns the current value (200) of the digital variable with index 2
<VALUE>200</VALUE>
</VARIABLE> End of the section for the integer variable with index 2 </VARIABLE>
</INTEGER> End of a section for integer variables </INTEGER>
<ANALOG> Start of a section for analog variables <ANALOG>
<VARIABLE> Start of the section for an analog variable <VARIABLE>
<INDEX>1</INDEX>
Specifies the index 1 for the variable to pCOWeb
<INDEX>1</INDEX>
<VALUE></VALUE>
pCOWeb returns the current value multiplied by 10 (999.9 x 10 = 9999) of the
analog variable with index 1
<VALUE>9999</VALUE>
</VARIABLE> End of the section for the analog variable with index 1 </VARIABLE>
<VARIABLE> Start of the section for another analog variable <VARIABLE>
<INDEX>2</INDEX>
Specifies the index 2 for the variable to pCOWeb
<INDEX>2</INDEX>
<VALUE></VALUE>
pCOWeb returns the current value multiplied by 10 (-12 x 10 = -120) of the analog
variable with index 2
<VALUE>-120</VALUE>
</VARIABLE> End of the section for the analog variable with index 2 </VARIABLE>
</ANALOG> End of a section for analog variables </ANALOG>
</PCO>
End of the section with the sequences of tags with pCO properties
</PCO>
</PCOWEB> End of the section recognising the sequences of tags </PCOWEB>
Table 4.a - The default “template.xml” file