7.6

Table Of Contents
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 XMLfile. Note that these will most likely not work with
your own XMLeven 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()
System Variables (by data type)
"Integer" (page 511)
"Measure" (page 512)
"String" (page 512)
"Boolean" (page 512)
Integer
&Current.DataPage (see "Current (system object)" (page 376))
©2010 Objectif Lune Inc - 511 -