XML data sharing is based on the
Client-Server architecture, i.e. one application (Web server) owns the data and one or more applications (Web clients) read these data or write into them.
The PROMOTIC application can be both the Web server and the Web client for XML data.
The
PROMOTIC Web server for XML data is implemented by means of the
PmaData object (and its "
Web server" tab) or by means of the
PmaDataTable object (and its "
Web server" tab). The
PmaData/
PmaDataTable object represents a Web component in this case. But in the application it is necessary to have one more
PmaWeb object that offers all Web components of the application as one Web server, see
Overview of the Web technology in the PROMOTIC system.
The
PROMOTIC Web client for XML data is implemented also by means of the
PmaData/
PmaDataTable object and its methods
ReadFromWeb and
WriteToWeb. If the application has to be only the Web client, then the
PmaWeb object doesn't need to be present.
By this way two PROMOTIC applications can simply exchange data in the real time. The
PmaData objects must contain the same variables in both (or more) applications, defined on the "
Data" tab.
For an example of the application see
Example of the communication by means of XML.
The
PmaDataTable object can dynamically change its data size by methods
InsertRow,
RemoveRow,
InsertCol or
RemoveCol.
But the size of data cannot be changed automatically by the XML transfer for security seasons! If it is necessary to change, for example, the size of data on the client application to be the same as on the server, then the number of rows on the server has to be got (e.g. by the XML query of
PmaData object), then to perform the change by the above mentioned method and only then to call the
ReadFromWeb method.
The XML communication supports the
transfer by a hierarchy method between the
PmaData objects. By this we mean that not only simple variables (as for example
Integer,
Single, etc.) find themselves in the
PmaData object but even a
reference to the data of another PmaData object can be a data item. Let's consider the case when the 1st item of the
/Data/DataA object has to refer to data of the
/Data/DataB object (both objects
DataA and
DataB are of the
PmaData type). Then the 1st data item of the
DataA object must be of the
Object type and set, for example, the following by the script command:
JavaScriptVBScriptSelect and copy to clipboard
pMe.Pm("/Data/DataA").Item(1) = pMe.Pm("/Data/DataB");
Set pMe.Pm("/Data/DataA").Item(1) = pMe.Pm("/Data/DataB")
or instead of this it is possible to create a data binding
PP Property of the Pma object or its subobject (Ini On property start) for the first data item. We fill in the path to the
DataB object in this
PP connection but we left the item for entering properties blank. Thus the 1st item of the
DataA object is connected directly to the
DataB object.
If the server and the client have these objects configured in the same way, then it is possible to transfer even the content of the
DataB object together with the
DataA object. This conception is advantageous if you have more
PmaData objects in the application but you want to transfer all of them in one message.
The Web client can be also for example
HTML page viewed by the Web browser (
Chrome,
Firefox,
Edge,
InternetExplorer ...). In this case it is possible to use the
<xml> tag in the HTML page that allows to read XML data from Web server. It is also possible to use also the dynamic HTML page that can read and write into the XML data.