bpi.xmlencode()
This subroutine will encode your data into a format that is compatible with XML. XML is the internal format used by office products like Word, Excel, Open office, Libre Office. Certain characters, like ampersand (&) and apostrophe ' are common in customer names and addressed (e.g., BILL & TED'S EXCELLENT ADVENTURE COMPANY) If you do not encode the data before passing it to the document builder, you will break the XML in the document and a invalid format error will result.
Subroutine Syntax
CALL bpi.xmlencode( in, out, target, error )
Parameters
Param |
Direction |
Description |
|
in |
passed |
This is an inbound string or array to be xmlencoded. Note, multivalue delimiters such as @AM will be unchanged so it is okay to pass an array to this subroutine. |
|
out |
returned |
This is an outbound string or array that is an xmlencoded form of the 'in' variable. |
|
target |
passed |
This specifies the scope of the XML encoding. Valid values are: |
|
all |
The characters & " ' < > will be encoded | ||
nocontainers |
only & ' and " will be encoded | ||
dataonly |
on the characters & ' and " will be encoded | ||
(blank) will default to 'all' | |||
You may also pass in the specific character you wish to have encoded into the target param. The valid characters to pass are & " ' < > | |||
error | returned | If no error is encountered, the routine will return a zero. Otherwise, it will return an error code. Currently, there are no error codes returned. |
Example
myArray = \\
myArray<name> = \Bruce & Dave\ ; *will be changed from & to &
myArray<favoriteQuote> = \He ain't heavy, he's my brother\ ; *will be changedchange ' to &apos
CALL bpi.xmlencode( myArray, encodedArray,\all\, error)
CRT \My xmlencoded array is: \:encodedArray