Home

aliazzz hermsen
There is a newer version of this page. You can find it here.

Project Members:

Usage

Simple and straightforward XML parsing and composing library.

Composing Usage example:

  1. Initialise
VAR
    XML : FB_XMLControl;
    Buffer: STRING(GVL_Param_XmlControl.udiMaxFileSize);
    // or 
    Buffer: ARRAY [0..GVL_Param_XmlControl.udiMaxFileSize] OF BYTE;
END_VAR
XML.pBuffer: = ADR (buffer);
XML.LenBuffer: = SIZEOF (buffer);

Add your own preferred fileheader like:

XML.WriteDocumentHeader( '<?xml version="1.0" encoding="UTF-8"?>');
  1. Compose a tag with a parameters:
    <MyTag ParaName = "11" />
    
XML.newTag(sTagName: = 'MyTag');
XML.newParameter(Name: = 'ParaName', Parameter: = 11);
XML.CloseTag();
  1. Add tag value:
    <MyTag> MyText </ MyTag>
    
XML.newTag(Name := 'MyTag');
XML.newTagData(TagData :='MyText');
XML.CloseTag();
  1. Jump to the beginning of the XML data
XML.toStartBuffer();
  1. Add a comment;
XML.newComment(sTagName: = 'MyComment');
  1. Returns the next tag from the current position in buffe;
XML.NextTag();
  1. Output the parameter of the tag;
XML.NextParameter(Parameter: = LastValue);

Feedback: Parameter returns the value found (string)

Contents of the library

FB_FileControl;
This function block can open, close, read and save a file from and to a generic PLC memory buffer
It can also read a small portions (chunks) of the file from disk to memory which enables you to load larger files in small portions.

FB_StringBuffer;
Acts as an IO stream buffer for use with FB_XmlControl.
Data can be treated as STRING or array of bytes.
The StringBuffer can also be used for other purposes like textfiles, csv, etc, etc.

FB_XmlControl:
Organizes Parsing and Composing of XML data.

Filebuffersize can be set via library parameter (Gvl_Param_XmlControl)
Note: Files do not necessarily need to be in a .xml format so you can use filecontrol to access any type of file.
Offcourse parsing and composing is only supported for xml formatted files.

Download

Latest version: v0.4.0.0

Download Library


Download Example