XML-SAX 命令コードの %XML オプション
- doc (デフォルト string)
- doc オプションは、%XML のソース・オペランドに含まれるものを示しています。
- string は、ソース・オペランドに XML データが含まれていることを表しています
- file は、ソース・オペランドに IFS ファイル名が含まれていることを示しています
図 1. doc オプションの例// In the following example, the first parameter // of %XML is the name of a file. Option // "doc=file" must be specified. ifsfile = 'myfile.xml'; opt = 'doc=file'; XML-SAX %handler(hdlr:comm) %XML(ifsfile : opt); // In the following example, the first parameter // of %XML is an XML document. Since the "doc" // option defaults to "string", no options are // necessary. xmldata = '<data><num>3</num></data>'; XML-SAX %handler(hdlr:comm) %XML(xmldata); - ccsid (デフォルト job)
- ccsid オプションは、XML データが戻される CCSID を指定します。
- job は、XML パーサーがジョブ CCSID にデータを戻すことを指示します。 この CCSID は、RPG コンパイラーがプログラム内の文字データ用に使用する CCSID です。
- ucs2 は、XML パーサーがモジュールの UCS-2 CCSID にデータを戻すことを指示します。
- 数値 は、XML パーサーが指定の CCSID にデータを戻すことを指示します。 この場合、RPG プログラムで正常にデータが処理され るようにプログラムする必要があります。 RPG コンパイラーでは、文字データがジョブ CCSID であると想定します。
図 2. ccsid オプションの例// In the following example, the data is to be // returned in the job ccsid. Even though the // default for the "ccsid" option is "job", it // is valid to specify it explicitly. XML-SAX %handler(hdlr:comm) %XML(xmlString : 'ccsid=job'); // In the following example, the data is to be // returned in UCS-2. opt = 'ccsid=ucs2'; XML-SAX %handler(hdlr:comm) %XML(xmldata : opt); // In the following example, the data is to be // returned in UTF-8. The handling procedure must // exercise caution to convert the data to some CCSID // that the program can handle, if the data is to be // used within the handling procedure. XML-SAX %handler(hdlr:comm) %XML(xmldata : 'ccsid=1208');注: *XML_UCS2_REF および *XML_ATTR_UCS2_REF イベントの場合、ccsid オプションとは無関係に、データは常に UCS-2 の値として戻されます。