PLISAXA サブルーチン

目的

プログラム バッファー内にある XML ドキュメントを処理するために XML パーサーを呼び出します。

構文

CALL PLISAXA(e, p, x, n, c)

パラメーター

e は、イベント構造体です。

p は、パーサーからイベント関数に渡すポインター値またはトークンです。

x は、処理対象の XML ドキュメントを含むバッファーのアドレスです。

n は、x で指定したバッファー内のデータのバイト数です。

c は、処理対象の XML ドキュメントのコード ページを指定する数値式です。

説明

PLISAXA 組み込みサブルーチンは、libmxml2 XML パーサーに基づく内部 SAX 解析を提供します。24 種類のイベントに対応しており、XML 文字列をポイントするメモリ アドレスを操作できます。この文字列のコードは ASCII でも EBCDIC でも構いません。

この例は、PLISAXA 組み込みサブルーチンの使用法を示しています。この例では、PLISAXA を呼び出すメイン ルーチンのみが示されており、イベント構造体や型宣言は示されていません。

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&quot;s best"/>'
||  '<?spread please use real mayonnaise ?>'
||  '<meat>Ham &amp; turkey</meat>'
||  '<filling>Cheese, lettuce, tomato, etc.</filling>'
||  '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.

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 ベースのアプリケーションを移行する場合の考慮事項を示します。

  • PLISAXA および PLISAXB イベント構造の一部である (ただし PLISAXC の一部でない) イベント unknown_attribute_reference (E20) が IBM の SAX プロセッサと同じコンテンツをともなって生成されますが、解析のより早い段階で発生します。
  • イベント unknown_content_reference (E21) の参照は、実際の値に拡張されます。
  • 2 つのイベント start_of_prefix_mapping (E22) および end_of_prefix_mapping (E23) は、IBM の PLISAXA および PLISAXB 機能によって記述されたアプリケーションとの互換性を維持するために現時点ではサポートされません。
  • SAX パーサーを使用する場合は、イベント exception (E24) は 1 回のみ発生してエラーを示し、exception イベントを文字ごとに 1 回発生させることは行いません。イベント exception (E24) の Micro Focus エラー コードのリストについては、「XML パーサーの例外イベント エラー コード」トピックを参照してください。