fbpx
Wikipedia

POSXML

POSXML (acronym for Point Of Sale eXtended Markup Language) is a programming language, based on XML, that is used to create applications for a POS terminal.

Normally the programming language used to develop such applications is C or C++. 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.

Language features edit

The structure of POSXML edit

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:

<!-- Variables declaration --> <stringvariable value="" variable="sTicketInfo"/> <stringvariable value="" variable="sCityInfo"/> <integervariable value="0" variable="iQtdTickets"/> <integervariable value="0" variable="iInvalidInfo"/>  <!-- Function Display MAIN Menu --> <function name="fMainMenu">  <integervariable value="0" variable="iOption"/>   <!-- Main Menu -->  <menu options="MAIN MENU:\\1.SALE OF TICKETS\2.REPORT\3.EXIT" variable="$(iOption)"/>   <!-- 1.SALE OF TICKETS -->  <if operator="equalto" value="1" variable="$(iOption)">  ...  </if>  ... </function> 

Compiled language edit

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 run 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.

Example:

<display line="0" column="0" message="Example of Bytecode" /> 

Compiled bytecode:

d0 \x0A 0 \x0A Bytecode example \x0A \x0D 

Syntax edit

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.

<network.hostdisconect/> <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 miliseconds="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.

Commands and instructions edit

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.

Variables and data types edit

Variables in POSXML are typed; there are only two types, integer and string. POSXML limits the number of declared variables to 512.

These variables are declared global, i.e. They are shared throughout all the scheduled pages of the POSXML program in runtime process.

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" /> <inputmoney 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 convert a variable of one type into the other type. In POSXML the commands inttostring and stringtoint are used for this.

Examples:

<integervariable value="1" variable="iOpcao_Tipo_Inteiro" /> <stringvariable value="" variable="sOpcao_Tipo_String" /> <inttostring integervariable="$(iOpcao_Tipo_Inteiro)" stringvariable="$(sOpcao_Tipo_String)" /> 

File system edit

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\nkey = buffer\n, basically the format of text files in a Unix environment, where \n is used to wrap. There are 8 basic commands in the POSXML language to work with files in the POS terminal, they are.

  • editfile
  • readfile
  • readfilebyindex
  • deletefile
  • file.open
  • file.write
  • file.read
  • file.close

Examples:

<editfile filename="test.txt" key="$(sChave)" value="$(sValor)" />   <readfile filename="test.txt" key="$(sChave)" variabledestination="$(sRetorno)" /> <readfilebyindex filename="test.db" index="0" variablekey="$(var1)" variablevalue="$(var2)" variablereturn="$(var3)" />   <deletefile filename="test.txt" /> 

Code examples edit

The traditional "Hello World" edit

<!-- An example application that shows the phgrase "Hello World" on the display. --> <!-- 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 /> 

Menu, functions and impressions edit

<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 parameter. 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> 

Dealing with the POS file edit

<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 /> 

An example with while "While" edit

<!-- 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 different 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 /> 

References edit

See also edit

posxml, this, article, needs, additional, citations, verification, please, help, improve, this, article, adding, citations, reliable, sources, unsourced, material, challenged, removed, find, sources, news, newspapers, books, scholar, jstor, june, 2016, learn, . This article needs additional citations for verification Please help improve this article by adding citations to reliable sources Unsourced material may be challenged and removed Find sources POSXML news newspapers books scholar JSTOR June 2016 Learn how and when to remove this message POSXML acronym for Point Of Sale eXtended Markup Language is a programming language based on XML that is used to create applications for a POS terminal Normally the programming language used to develop such applications is C or C 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 Contents 1 Language features 1 1 The structure of POSXML 1 2 Compiled language 1 3 Syntax 1 4 Commands and instructions 1 5 Variables and data types 1 6 File system 2 Code examples 2 1 The traditional Hello World 2 2 Menu functions and impressions 2 3 Dealing with the POS file 2 4 An example with while While 3 References 4 See alsoLanguage features editThe structure of POSXML edit 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 lt Variables declaration gt lt stringvariable value variable sTicketInfo gt lt stringvariable value variable sCityInfo gt lt integervariable value 0 variable iQtdTickets gt lt integervariable value 0 variable iInvalidInfo gt lt Function Display MAIN Menu gt lt function name fMainMenu gt lt integervariable value 0 variable iOption gt lt Main Menu gt lt menu options MAIN MENU 1 SALE OF TICKETS 2 REPORT 3 EXIT variable iOption gt lt 1 SALE OF TICKETS gt lt if operator equalto value 1 variable iOption gt lt if gt lt function gt Compiled language edit 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 run 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 Example lt display line 0 column 0 message Example of Bytecode gt Compiled bytecode d0 x0A 0 x0A Bytecode example x0A x0D Syntax edit 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 lt network hostdisconect gt lt cleandisplay gt lt waitkey gt Commands that require instructions and parameters to interact with the equipment lt display line 1 column 1 message POSXML gt lt menu variable var1 options MENU 1 first line 2 second line 3 third line gt lt wait miliseconds 1000 gt 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 Commands and instructions edit 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 Variables and data types edit Variables in POSXML are typed there are only two types integer and string POSXML limits the number of declared variables to 512 These variables are declared global i e They are shared throughout all the scheduled pages of the POSXML program in runtime process Examples String type variable lt Declaring a string type variable containing http en wikipedia org wiki posxml gt lt stringvariable value http en wikipedia org wiki posxml variable url gt lt Accessing the content of the declared variable gt lt display line 0 column 0 message url gt Integer type variable lt Declaring an integer type variable containing 0 gt lt integervariable value 0 variable iValue gt lt inputmoney column 0 line 0 message Enter the amount variable iValue gt 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 convert a variable of one type into the other type In POSXML the commands inttostring and stringtoint are used for this Examples lt integervariable value 1 variable iOpcao Tipo Inteiro gt lt stringvariable value variable sOpcao Tipo String gt lt inttostring integervariable iOpcao Tipo Inteiro stringvariable sOpcao Tipo String gt File system edit 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 nkey buffer n basically the format of text files in a Unix environment where n is used to wrap There are 8 basic commands in the POSXML language to work with files in the POS terminal they are editfile readfile readfilebyindex deletefile file open file write file read file close Examples lt editfile filename test txt key sChave value sValor gt lt readfile filename test txt key sChave variabledestination sRetorno gt lt readfilebyindex filename test db index 0 variablekey var1 variablevalue var2 variablereturn var3 gt lt deletefile filename test txt gt Code examples editThe traditional Hello World edit lt An example application that shows the phgrase Hello World on the display gt lt The command display shows a message in a row and column specific gt lt display line 3 column 0 message Hello World gt lt The command waitkey waits till the operator press someone key for continue the execution gt lt waitkey gt Menu functions and impressions edit lt stringvariable value variable stringName gt lt stringvariable value variable stringValue gt lt integervariable value 0 variable integerValue gt lt integervariable value 0 variable integerOption gt lt The command menu is used to show a menu in the terminal s display The captured value is put in variable gt lt menu variable integerOption options Menu 1 Main Function 2 Print Function gt lt if variable integerOption operator equalto value 1 gt lt The command callfunction is used to call a function defined with the function instruction gt lt callfunction name Main gt lt if gt lt if variable integerOption operator equalto value 2 gt lt The command callfunction is used to call a function defined with the function instruction gt lt callfunction name Print gt lt if gt lt The command function is used to make functions in PosXml Application gt lt function name Main gt lt 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 gt lt inputmoney variable integerValue line 0 column 0 message Input de Value gt lt cleandisplay gt lt The command inttostring is used to convert an integer variable in a string variable gt lt inttostring variableinteger integerValue variablestring stringValue gt lt display line 2 column 0 message Value is gt lt display line 3 column 0 message stringValue gt lt waitkey gt lt function gt lt function name Print gt lt The command inputformat is used to enter a value in a specific format The format is specified in the format parameter The value captured is put in variable gt lt inputformat variable stringName line 0 column 0 message Enter your name format AAAAAAAAAA gt lt print message stringName gt lt The command paperfeed is used to advance paper of the terminal s printer gt lt paperfeed gt lt function gt Dealing with the POS file edit lt stringvariable value variable stringRet gt lt stringvariable value variable stringWriteKey gt lt stringvariable value variable stringWriteValue gt lt inputformat variable stringWriteKey line 0 column 0 message Input a key format AAAAAAAAAA gt lt inputformat variable stringWriteValue line 2 column 0 message Input a value format 9999999999 gt lt 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 gt lt editfile filename test txt key stringWriteKey value stringWriteValue gt lt 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 gt lt readfile filename test txt key stringWriteKey variabledestination stringRet gt lt The command deletefile is used to remove a file from the terminal s memory gt lt deletefile filename test txt gt lt The command joinstring is used to join firstvalue and secondvalue in variabledestination gt lt joinstring firstvalue Result secondvalue stringRet variabledestination stringRet gt lt cleandisplay gt lt display line 4 column 0 message stringRet gt lt waitkey gt An example with while While edit lt The command stringvariable creates in memory one variable of a type string in this case the name is sData gt lt stringvariable value variable stringData gt lt stringvariable value KEY CANCEL variable stringKey gt lt The command while realizes a loop till the condition be satisfied in this case when the value of sKey be different of KEY CANCEL gt lt while variable stringKey operator equalto value KEY CANCEL gt lt The command cleandisplay is used to clean the terminal s display gt lt cleandisplay gt lt The command getdatetime extract the date and the hour internal in format specified and save this value in variabledestination gt lt getdatetime format d M yy h m s variabledestination stringData gt lt The command display shows a message in a row and column specific gt lt display line 2 column 0 message stringData gt lt 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 gt lt readkey miliseconds 800 variablereturn stringKey gt lt while gt lt display line 2 column 0 message stringKey gt lt waitkey gt References editSee also editCredit cards Private label Visa Inc Mastercard Visanet Redecard HDLC GPRS SSL RENPAC ADSL Retrieved from https en wikipedia org w index php title POSXML amp oldid 1220363003, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.