cpiCreateParserFactory

目的

名前付きパーサー・ファクトリーの単一のインスタンスをメッセージ・ブローカーに作成します。 これは、メッセージ・ブローカーによって「lil」がロードされる際に呼び出される初期化関数 bipGetParserFactory の中でしか呼び出すことができません。 他の場合に cpiCreateParserFactory が呼び出されても、結果は予測不可能です。

構文

CciFactory* cpiCreateParserFactory(
int*           returnCode,
CciChar*  name);

パラメーター

returnCode
関数からの戻りコードを受け取ります (出力)。考えられる戻りコードは以下のとおりです。
  • CCI_SUCCESS
  • CCI_EXCEPTION
  • CCI_FAILURE
  • CCI_INV_FACTORY_NAME
  • CCI_INV_OBJECT_NAME
name
作成するファクトリーの名前を指定します (入力)。

戻り値

成功した場合、パーサー・ファクトリー・オブジェクトのアドレスが戻されます。 正常に実行されない場合は、ゼロの値 (CCI_NULL_ADDR) が戻され、 returnCode がエラーの理由を示します。

サンプル

この例は、サンプル・パーサー・ファイル BipSampPluginParser.c から取られています (862 行から 901 行)。

void LilFactoryExportPrefix * LilFactoryExportSuffix bipGetParserFactory()
{
/* Declare variables */
CciFactory*     factoryObject;
int             rc;
static CPI_VFT  vftable = {CPI_VFT_DEFAULT};
/* Before we proceed we need to initialise all the static constants */
/* that may be used by the plug-in.                                 */
  initParserConstants();
/* Setup function table with pointers to parser implementation functions */
vftable.iFpCreateContext            = cpiCreateContext;
vftable.iFpParseBufferEncoded       = cpiParseBufferEncoded;
vftable.iFpParseFirstChild          = cpiParseFirstChild;
vftable.iFpParseLastChild           = cpiParseLastChild;
vftable.iFpParsePreviousSibling     = cpiParsePreviousSibling;
vftable.iFpParseNextSibling         = cpiParseNextSibling;
vftable.iFpWriteBufferEncoded       = cpiWriteBufferEncoded;
vftable.iFpDeleteContext            = cpiDeleteContext;
vftable.iFpSetElementValue          = cpiSetElementValue;
vftable.iFpElementValue             = cpiElementValue;
vftable.iFpNextParserClassName      = cpiNextParserClassName;
vftable.iFpSetNextParserClassName   = cpiSetNextParserClassName;
vftable.iFpNextParserEncoding       = cpiNextParserEncoding;
vftable.iFpNextParserCodedCharSetId = cpiNextParserCodedCharSetId;
/* Create the parser factory for this plugin */
factoryObject = cpiCreateParserFactory(&rc, constParserFactory);
if (factoryObject) {
/* Define the classes of message supported by the factory */
cpiDefineParserClass(&rc, factoryObject, constPXML, &vftable);
}
else {
/* Error: Unable to create parser factory */
}
/* Return address of this factory object to the broker */
return(factoryObject);
}
関連概念
ユーザー定義のパーサー
ユーザー定義拡張機能
関連タスク
C でのパーサーの作成
関連資料
cpiDefineParserClass
C パーサー・ユーティリティー関数
特記事項 | 商標 | ダウンロード | ライブラリー | サポート | フィードバック
Copyright IBM Corporation 1999, 2006 Last updated: 5 01, 2006
as08240_