Invokes the XML parser for processing an XML document residing in a program buffer.
CALL PLISAXA(e, p, x, n, c)
e is an event structure.
p is a pointer value or token that the parser passes to the event functions.
x is the address of the buffer that contains the XML document for processing.
n is the number of bytes of data in the buffer specified by x.
c is a numeric expression that specifies the code page of the XML document for processing.
This example shows the use of the PLISAXA built-in. The example shows only the main routine with a call to PLISAXA, it does not show the event structure or the type declarations.
dcl token char(8); dcl xmlDocument char(4000) var; xmlDocument = '<?xml version="1.0" standalone="yes"?>' || '<!--This document is just an example-->' || '<sandwich>' || '<bread type="baker"s best"/>' || '<?spread please use real mayonnaise ?>' || '<meat>Ham & turkey</meat>' || '<filling>Cheese, lettuce, tomato, etc.</filling>' || '<![CDATA[We should add a <relish> element in future!]]>'. || '</sandwich>' || 'junk'; call plisaxa( eventHandler, addr(token), addrdata(xmlDocument), length(xmlDocument) ); end;
If using the -ebcdic option to compile your program, the callback event logic should account for the fact that the data passed back to the call backs is in ASCII, even if the input format was in EBCDIC. Because of this, the data must be translated prior to use within the callbacks. In addition, all reference values passed as a FIXED BIN(31) are for ASCII character encoding.
On UNIX, if your XML input is EBCDIC and contains open and close square brackets (e.g. []) and they are of the value X'BA' and X'BB', then you need to create your own custom codeset module for translation of these routines, and where you execute them, you need to set the environment variable MFCODESET to point to your custom codeset. This does not apply for ASCII input.
It is assumed that your program is built using the -bigendian compiler option if operating on an Intel Chip. If compiling your program without using the -bigendian compiler option, then you must convert the parameter types to/from -bigendian prior to use.
The following are considerations if migrating an existing z/OS based application:
Description
The PLISAXA built-in subroutine provides internal SAX parsing based on the libmxml2 XML parser. It provides 24 distinct events and operates on a memory address that points to an XML string. That string can be in ASCII or EBCDIC.