7.5

Table Of Contents
Syntax
xmlGet(path:string) string value
Arguments
path
The XMLPath of the value you want to retrieve. The path must correspond to a single entry in the XML, thus is not a complete
XPath with regular expressions and variables.
Code Sample
These are examples of xmlGet()commands returning data from an XMLfile. Note that these will most likely not work with
your own XMLeven if you tried, as the path is completely dependent on the exact structure of your XMLData file.
define(&myVar, string, '')
&myVar := xmlget('/PLANETPRESS_DATA_FILE[1]-
/CUSTOMER[1]/INVOICES[1]/INVOICE[1]/ITEM[1]/Description[1]')
&myVar := xmlget('/MyData/CUSTOMER[1]/INVOICES[1]/INVOICE[1]/ITEM[1]/Description[1]')
% This next line uses the &i variable to dynamically select an item in the invoice. Use-
ful in a repeat & overflow
% configuration, or a manual PlanetPress Talk loop through te data. Note that the var-
iable must be converted to a string.
&myVar := xmlget('-
/MyData/CUSTOMER[1]/INVOICES[1]/INVOICE[1]/ITEM['+inttostr(&i)+']/Description[1]')
Example 2
The following gets the number of items in an invoice, loops through each item and displays the item's description with show().
define(&i, integer, 0)
define(&currentItemDescription, string, '')
define(&numberOfItems, integer, xmlcount('/MyData/CUSTOMER/INVOICES/INVOICE/ITEM'))
for(&i, 1, 1, &numberOfItems)
&currentItemDescription := xmlget('-
/MyData/CUSTOMER/INVOICES/INVOICE/ITEM['+inttostr(&i)+']/Description')
show(&currentItemDescription)
crlf()
endfor()
Boolean
Add (function)
Adds two numerical expressions. This is the functional equivalent to the + operator, when you use the + operator with numer-
ical expressions.
©2010 Objectif Lune Inc - 551 -