POSXML
This article is an orphan, as few or no other articles link to it. Please introduce links to this page from related articles; suggestions are available. (January 2010) |
POSXML (acronym for Point Of Sale eXtended Markup Language) is a programming language that is used to create applications for a POS terminal.
Normally the programming language used to develop such applications is C or C++. This development requires an in-dept knowledge of both the technical specifications of the machine (Hardware) and the programming language.
The main purpose of POSXML is to simplify the development of applications for POS terminals. It contains a set of instructions and pre-programmed commands, which allow direct interaction with the machine, resulting in a large reduction in application development time.
Most of these instructions and commands are in Portuguese to simplify the understanding during the work on the applications, but it is perfectly possible to develop applications using an English syntax.
Language Features
The structure of POSXML
The POSXML language, like the name suggests, follows the open standard language for XML, which is widespread in the software industry. The XML standard is fully flexible and allows a rapid expansion of language.
- POSXML is organized and structured in the form of tags, showing levels and subsets of a set of commands and instructions, that form the logical structure of a POSXML application.
Example:
<?xml version="1.0"?>
<posxmlapplication xmlns="http://tempuri.org/posxml.xsd">
...
...
...
</posxmlapplication>
- Any program written in POSXML has a father or root tag which is identified by a valid identifier /name. Under(Below) the father tag, the programmer writes a section called page, which is a block of the application that is executed when requested.(called on?)
Every program written in POSXML contains a page called Main, which is the (main) application that will be stored in a POS terminal. The language allows you to write as many pages as necessary, or even write the whole application logic inside one page, the main page. The only restriction is that the size of the compiled page can't be larger than 32 Kbytes. To give an idea of the compression offered by the platform: a common application with 1600 lines of code contained 76 kbytes in POSXML, when compiled its size is reduced to 15 kbytes.
Applications that have multiple pages are used (being deployed on a server, called WALK) with the softwareserver (gateway) called WALK Server (developed by the same company that created the language POSXML), one can use just the main page when you use this server (Server WALK).
Examples of instructions that can be used within these pages are: printing content (such as tickets, receipts, vouchers), other output routines, data capture, mathematical calculations, time, etc.
Example:
<posxmlapplication xmlns="http://tempuri.org/posxml.xsd">
<page name="main">
<display line="1" column="0" message="POSXML Application" />
<display line="2" column="0" message="Plano Be Tecnologia"/>
<waitkey />
<cleandisplay />
<connect />
</page>
</posxmlapplication>
- By default, the structure of XML has some characters that are reserved for the well respected POSXML language and are written in the right way
* < ; < * > ; > * & ; & * &apos ; ' * " ; "
Example:
<posxmlapplication xmlns="http://tempuri.org/posxml.xsd">
<page name="main">
<callfunction name="showmessage" />
<function name="showmessage">
<display line="0" column="0" message="< = menor" />
<waitkey />
</function>
</page>
</posxmlapplication>
- Like XML, POSXML accepts the definition of comment sections that facilitate(allow) the documentation of the program.
Example:
<posxmlapplication xmlns="http://tempuri.org/posxml.xsd">
<page name="main">
<!-- This example shows the use of a -->
<!-- function to show a message on the display -->
<callfunction name="showmessage" />
<function name="showmessage">
<display line="0" column="0" message="< = menor" />
<waitkey />
</function>
</page>
</posxmlapplication>
Compiled Language
Similar to the vast majority of existing programming languages, POSXML is compiled in a specific format to reduce the file size which allows the application to be ran on a POS terminal using a framework (virtual machine).
When compiled, a program written in POSXML, becomes a set of bytecodes that are interpreted by the virtual machine on the POS terminal which results in the implementation on the POS terminal.
Every command, function or instruction of the program written in POSXML, after compilation, becomes a single byte code that identifies the library command framework (virtual machine).
Example:
<display line="0" column="0" message="Example of Bytecode" />
Compiled bytecode:
d0 \x0A 0 \x0A Bytecode example \x0A \x0D
- An application in POSXML compiled and installed on the POS terminal is located on the 4th layer of software found on the device. In other words: the POS terminal has on operating system on which a framework is installed. Applications developed in POSXML are then deployed on this virtual machine. The image below demonstrates this:
The model used to compile into byte code, which allows the application to be interpreted by a virtual machine, allows a program written in POSXML to be used, or rather be interpreted by the virtual machine in different POS terminals, since the brand and models have specified a framework approved.
This means that after an application developed to a specific type of POS terminal, the programmer can choose to use the same application on another terminal. The virtual machine is compatible with such equipment, there is no need for any amendment or implementation of the code POSXML original source of the first equipment.
- This portability ensures that migrating applications between different makes and brands of POS terminals requires only a minimal to no effort.
The language
Structured and formatted in the XML format, POSXML is characterized by a set of commands and instructions that interact with the equipment. This makes it easy to perform simple tasks such as printing data, reading data from a magnetic stripe card, data entry via a keypad, among other functions of the POS terminal.
Syntax
Each program developed in the POSXML language for a POS terminal is identified by a Main tag called posxmlapplication, obeying the rule to write in lowercase letters, which is required in each new program. This tag, also called the parent/father tag, is essential to identify a program in POSXML and ensure a correct compilation.
Example:
<posxmlapplication xmlns="http://tempuri.org/posxml.xsd">
...
...
...
</posxmlapplication>
The commands and instructions of POSXML, such as the compliance on the use of capital letters and lowercase letters (case sensitive), are acquired through training. Some commands that belong to the language do not require parameters, unlike other commands that need input to interact with the machine.
Examples:
Commands that do not require instructions or parameters.
<connect />
<cleandisplay />
<waitkey />
Commands that require instructions and parameters to interact with the equipment.
<display line="1" column="1" message="POSXML" />
<menu variable="$(var1)" options="MENU\1. first line\2. second line\3. third line"/>
<wait milisegundos="1000" />
The names given to functions, variables, and pages should also obey the rules written in capital letters and lowercase letters, so if a developer creates a function called "calcula_digito" he will not be able to call on the variable via "Calcula_Digito". The call of a function, or variable page must meet the exact name that was assigned by the programmer.
Its parts
The POSXML language basically consists of 3 parts, namely:
- a main tag;
- The home page indispensable to the development of the application;
- And the additional pages (these are only set when the programmer chooses to use the transaction server, called WALK Server, which is a transaction gateway that controls the updates of applications in POS terminal in an automated manner).
When a developer writes an application POSXML, he must first use the home tag to write the application which, when compiled, will be stored in the POS terminal until a new version is available.
Additional pages that are included in a POSXML program, are compiled in as they are requested, on the server side by WALK Server (optionally when it is used). These additional pages may contain blocks of code that will perform tasks such as printing data, mathematical calculations, file operations and other functions.
Example:
<posxmlapplication xmlns="http://tempuri.org/posxml.xsd">
<page name="main">
<display column="0" line="3" message="Main Page" />
<waitkey />
</page>
<page name="print_test">
<printbig message=" P O S X M L " />
<print message="A print from the second page" />
</page>
</posxmlapplication>
Commands and instructions
Because it is a structured language based on XML, POSXML is a language that is constantly evolving, new commands and instructions can be added to your library at any time. Initially, the language had only two dozen basic commands to create a functional application on a POS terminal, using few resources: only the basic display (LCD), keypad, magnetic card reader and printer.
With the evolution of language, there are now almost one hundred commands and instructions available to deal with files, pictures, mathematical operators, functions to manipulate variables of the String type, definition of variables, logical operators, classes for working with protocol ISO 8583 (Protocol standard for exchanging information in transactions with credit cards), among others.
Some important commands
* display * cleandisplay * menu * digitainteiro * digitavalor * digitaformato * digitaopcao * print * printbig * printbitmap * imprimacodigodebarras * iso8583.iniciatabelacampos * iso8583.iniciamensagem * iso8583.analisamensagem * iso8583.finalizamensagem * editarquivo * learquivo * learquivobyindex * connect * preconexao * desligamodem * network.send * network.receive * network.httprequest * network.webservicenew * integervariable * stringvariable * guardavariavel * limpavariaveis * string.charat * string.trim * string.find * string.replace * string.substring * function * callfunction
Tens of commands and instructions complete the set of language.
Variables and data types
Like any programming language, such as Basic, Pascal, C, C + + , POSXML also allows the use of variables in memory with defined types. POSXML does not offer such an extensive range of data types like the languages mentioned before. There are only two possible types of variables: integers and strings. But a variable of type Double can still be formed by declaring a String type variable and feeding it with values that contain decimal places separated from the whole part with a period and not a comma.
POSXML limits the number of declared variables to 512. It is for example possible to declare 256 String types variables and 256 integer type variables.
These variables are declared global, i.e. They are shared throughout all the scheduled pages of the POSXML program.
Examples:
String type variable:
<!-- Declaring a string type variable containing: "http://en.wikipedia.org/wiki/posxml" -->
<stringvariable value="http://en.wikipedia.org/wiki/posxml" variable="url" />
<!-- Accessing the content of the declared variable -->
<display line="0" column="0" message="$(url)" />
Integer type variable:
<!-- Declaring an integer type variable containing: "0" -->
<integervariable value="0" variable="iValue" />
<!-- Accessing the content of the declared variable -->
<digitavalor column="0" line="0" message="Enter the amount:" variable="$(iValue)" />
A call to a variable that is declared in the memory, is made by $(name_of_the_variable), regardless of its type.
It is also possible to covert a variable of one type into the other type. In POSXML the commands inttostring and stringtoint are used for this.
Examples:
<variavelint valor="1" variavel="iOpcao_Tipo_Inteiro" />
<variavelint valor="" variavel="sOpcao_Tipo_String" />
<inttostring variavelint="$(iOpcao_Tipo_Inteiro)" variavelstr="$(sOpcao_Tipo_String)" />
File System
When writing an application for a POS terminal, the developer is faced with the need to write to the specific file system of the equipment. The POSXML language works with files of type WALK dbFile (A file system defined by the framework that interprets a program compiled POSXML). This file system WALK dbFile uses the format: key = buffer \ n key = buffer \ n, basically the format of text files in an Unix environment , where \ n is used to wrap. There are 4 basic commands in the POSXML language to work with files in the POS terminal, they are.
* editaarquivo * learquivo * learquivobyindex * excluirarquivo
Examples:
<editaarquivo nomearquivo="teste.txt" chave="$(sChave)" valor="$(sValor)" />
<learquivo nomearquivo="teste.txt" chave="$(sChave)" variaveldestino="$(sRetorno)" />
<learquivobyindex nomearquivo="teste.db" index="0" variavelchave="$(var1)" variavelvalor="$(var2)" variavelretorno="$(var3)" />
<excluiarquivo nomearquivo="teste.txt" />
Overview
History
In 2005, due to the constant growing number of POS terminals and related equipment, there were speed and flexibility issues with the applications written for these terminals. These programs were used by regional companies to manage their own credit cards, private label cards and all had their changing needs.
The development of these applications was usually done in C. Each time the market launched a new type of terminal or when a new manufacturer entered the market, the same application had to be rewritten and adapted to the new terminal. This process was considered slow and expensive. Implementing new features in existing applications developed in C was also difficult.
Out of these problems grew the need for a standard language that would allow faster and more flexible development of applications for POS terminals, to better fit the needs of the companies involved. The basics would be to develop a program suitable to POS terminals, whose commands and instructions were pre-programmed and which allowed to interact with the equipment in a simple way.
The use of the standard structure of XML was important because it gives sufficient flexibility to expand the language if necessary, without many changes to the basic API language.
The language id accessible to other programmers and developers, wich increaes the value chain of POS terminals.
POSXML was developed in 2005 by the Brazilian company Plano Bê.
The POSXML language and its tools have been tested and implemented by programmers from several countries such as Mexico, Chile, Argentina, Colombia, Dominican Republic, USA, Turkey, India, Russia and some countries of the Middle East.
Attributes
- Flexible
- Expandable
- Multilingual: English, Portuguese and Spanish
- Structured
- Compiled
- Easy learning
- Interactive
- Quick
- It does not require knowledge of hardware (machine)
- Not require knowledge of C
What it is not
Although the language is structured in standard XML, POSXML is not an open language that can be used by a browser, such as WML, which is generally used in applications WAP that are performed by mobile devices such as mobile phones.
Code examples
The traditional "Hello World"
<posxmlapplication xmlns="http://tempuri.org/posxml.xsd">
<!-- An example application that shows the phgrase "Hello World" on the display. -->
<page name="main">
<!-- The command "display" shows a message in a row and column specific. -->
<display line="3" column="0" message="Hello World" />
<!-- The command "waitkey" waits till the operator press someone key for continue the execution. -->
<waitkey />
</page>
</posxmlapplication>
Menu, functions and impressions
<posxmlapplication xmlns="http://tempuri.org/posxml.xsd">
<page name="main">
<stringvariable value="" variable="stringName" />
<stringvariable value="" variable="stringValue" />
<integervariable value="0" variable="integerValue" />
<integervariable value="0" variable="integerOption" />
<!-- The command menu is used to show a menu in the terminal's display. The captured value is put in variable. -->
<menu variable="$(integerOption)" options="\Menu\ 1) Main Function\ 2) Print Function" />
<if variable="$(integerOption)" operator="equalto" value="1" >
<!-- The command callfunction is used to call a function defined with the function instruction. -->
<callfunction name="Main" />
</if>
<if variable="$(integerOption)" operator="equalto" value="2" >
<!-- The command callfunction is used to call a function defined with the function instruction. -->
<callfunction name="Print" />
</if>
<!-- The command function is used to make functions in PosXml Application. -->
<function name="Main" >
<!-- The command inputmoney is used to enter money values in the terminal.
The terminal shows a mask with comma and points, while pressing the digit keys.
The captured value is multiplied by 100 and put in variable without comma and points. -->
<inputmoney variable="$(integerValue)" line="0" column="0" message="Input de Value:" />
<cleandisplay />
<!-- The command inttostring is used to convert an integer variable in a string variable. -->
<inttostring variableinteger="$(integerValue)" variablestring="$(stringValue)" />
<display line="2" column="0" message="Value is:" />
<display line="3" column="0" message="$(stringValue)" />
<waitkey />
</function>
<function name="Print" >
<!-- The command inputformat is used to enter a value in a specific format.
The format is specified in the format paramater. The value captured is put in variable. -->
<inputformat variable="$(stringName)" line="0" column="0" message="Enter your name:" format="AAAAAAAAAA" />
<print message="$(stringName)" />
<!-- The command paperfeed is used to advance paper of the terminal's printer. -->
<paperfeed />
</function>
</page>
</posxmlapplication>
Dealing with the POS file
<posxmlapplication xmlns="http://tempuri.org/posxml.xsd">
<page name="main">
<stringvariable value="" variable="stringRet" />
<stringvariable value="" variable="stringWriteKey" />
<stringvariable value="" variable="stringWriteValue" />
<inputformat variable="$(stringWriteKey)" line="0" column="0" message="Input a key:" format="AAAAAAAAAA" />
<inputformat variable="$(stringWriteValue)" line="2" column="0" message="Input a value:" format="9999999999" />
<!-- The command editfile is used to write or edit a file in 'Walk Db format'.
The format of the file in 'Walk Db format', is: ('key=value\nkey=value\n ... '). -->
<editfile filename="test.txt" key="$(stringWriteKey)" value="$(stringWriteValue)" />
<!-- The command readfile is used to read a file in 'Walk Db format'.
The format of the file in 'Walk Db format', is: ('key=value\nkey=value\n ... ').
If the file or key does exist, the value is a white space ' '. -->
<readfile filename="test.txt" key="$(stringWriteKey)" variabledestination="$(stringRet)" />
<!-- The command deletefile is used to remove a file from the terminal's memory. -->
<deletefile filename="test.txt" />
<!-- The command joinstring is used to join firstvalue and secondvalue in variabledestination. -->
<joinstring firstvalue="Result:" secondvalue="$(stringRet)" variabledestination="$(stringRet)" />
<cleandisplay />
<display line="4" column="0" message="$(stringRet)" />
<waitkey />
</page>
</posxmlapplication>
An example with while "While"
<posxmlapplication xmlns="http://tempuri.org/posxml.xsd">
<page name="main">
<!-- The command "stringvariable" creates in memory one variable of a type string, in this case the name is "sData". -->
<stringvariable value="" variable="stringData" />
<stringvariable value="KEY_CANCEL" variable="stringKey" />
<!-- The command "while" realizes a loop till the condition be satisfied in this case,
when the value of "sKey" be diferent of "KEY_CANCEL". -->
<while variable="$(stringKey)" operator="equalto" value="KEY_CANCEL" >
<!-- The command cleandisplay is used to clean the terminal's display. -->
<cleandisplay />
<!-- The command "getdatetime" extract the date and the hour internal in format specified,
and save this value in "variabledestination". -->
<getdatetime format="d/M/yy h:m:s" variabledestination="$(stringData)" />
<!-- The command "display" shows a message in a row and column specific. -->
<display line="2" column="0" message="$(stringData)" />
<!-- The command "readkey" waits a specified time in miliseconds to save in a string on "variablereturn",
case not be tight anybody key, will be return the value "KEY_CANCEL". -->
<readkey miliseconds="800" variablereturn="$(stringKey)" />
</while>
<display line="2" column="0" message="$(stringKey)" />
<waitkey />
</page>
</posxmlapplication>
Adding extra pages
<posxmlapplication xmlns="http://tempuri.org/posxml.xsd">
<page name="main">
<integervariable value="0" variable="option" />
<menu variable="$(option)" options="*** POSXML *** \1.Sale\2.Balance\" />
<if variable="$(option)" operator="equalto" value="1" >
<cleandisplay />
<stringvariable value="http://0.0.0.0/simulaRetornoWALK/autorizadorsample.aspx?option=1" variable="url" />
<stringvariable value="" variable="card" />
<integervariable value="0" variable="value" />
<pegacartaoevariable firstmessage="Enter the card" secondmessage="Enter the amount" minimum="16" maximum="16" variable="$(card)" />
<digitavalor variable="$(value)" line="0" column="0" message="Enter the amount" />
<guardavariable variable="$(url)" />
<guardavariable variable="$(card)" />
<guardavariable variable="$(value)" />
<connect />
</if>
<if variable="$(option)" operator="equalto" value="2" >
<cleandisplay />
<stringvariable value="http://0.0.0.0/simulaRetornoWALK/autorizadorsample.aspx?option=3" variable="url" />
<stringvariable value="" variable="card" />
<pegacartaoevariable firstmessage="Enter the card" secondmessage="Enter the amount" minimum="16" maximum="16" variable="$(card)" />
<guardavariable variable="$(url)" />
<guardavariable variable="$(card)" />
<connect />
</if>
</page>
<page name="coupon_sales">
<integervariable value="0" variable="iRet" />
<integervariable value="0" variable="retPrintBitmap" />
<stringvariable value="" variable="datahora" />
<pegadatahora format="d/M/yy h:m ONL-D" variaveldestino="$(datahora)" />
<printbitmap nomearquivo="logomarcas.bmp" variavelretorno="$(retPrintBitmap)" />
<if operator="igual" value="0" variable="$(retPrintBitmap)" >
<display column="0" line="2" message="Baixando bitmap..." />
<baixaarquivo caminhoremoto="\logomarcas.bmp" excluiaposdownload="0" nomearquivo="logomarcas.bmp" variavelretorno="$(iRet)" />
<if operator="igual" value="0" variable="$(iRet)" >
<print message="logomarcas.bmp nao encontrado" />
<else />
<printbitmap nomearquivo="logomarcas.bmp" variavelretorno="$(retPrintBitmap)" />
</if>
</if>
<printbig message=" P O S X M L " />
<print message=" * simulation of authorisation *" />
<print message=" " />
<print message="CARD: [card]" />
<print message=" " />
<print message="Name of the company" />
<print message="Company address" />
<print message="DOC=000000 AUT=000000" />
<print message="$(datahora)" />
<print message="SALES OF [tipovenda]" />
<print message=" " />
<print message="value: [value]" />
<print message=" " />
<printbig message=" VISIT " />
<printbig message=" WWW.PLANOBE.COM " />
<paperfeed />
</page>
<page name="coupon_balance">
<integervariable value="0" variable="iRet" />
<stringvariable value="" variable="datahora" />
<printbig message=" P O S X M L " />
<print message=" * simulation of authorisation *" />
<print message=" " />
<print message="CARD: [card]" />
<print message=" " />
<print message="Name of the company" />
<print message="Company address" />
<print message="DOC=000000 AUT=000000" />
<print message="$(datahora)" />
<print message="BALANCE INQUIRY" />
<print message=" " />
<print message="REMAINING BALANCE: [balance]" />
<print message=" " />
<printgrande message=" VISIT " />
<printgrande message=" WWW.PLANOBE.COM " />
<paperfeed />
</page>
</posxmlapplication>
References
Other sources
If you like SEOmastering Site, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...