ファイル内にある XML ドキュメントを処理するために XML パーサーを呼び出します。
CALL PLISAXB(e, p, x, c)
e は、イベント構造体です。
p は、パーサーからイベント関数に渡すポインター値またはトークンです。
x は、入力ファイルの文字列式です。
c は、処理対象の XML ドキュメントのコード ページを指定する数値式です。
この例は、PLISAXB 組み込みサブルーチンの使用法を示しています。この例では、PLISAXB を呼び出すメイン ルーチンのみが示されており、イベント構造体や型宣言は示されていません。
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>' || 'We should add a <relish> element in future!'. || '</sandwich>' || ' '; call plisaxb( 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.
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.
次に、既存の z/OS ベースのアプリケーションを移行する場合の考慮事項を示します。
説明
PLISAXB 組み込みサブルーチンは、libmxml2 XML パーサーに基づく内部 SAX 解析を提供します。24 種類のイベントに対応しており、ファイルを操作できます。入力ファイルの文字列式のコードは ASCII でも EBCDIC でも構いません。