cpiRootElement

目的

指定したパーサー・オブジェクトのルート構文エレメントのアドレスを取得します。

構文

CciElement* cpiRootElement(
  int*           returnCode,
  CciParser*   parser);

パラメーター

returnCode
関数からの戻りコードを受け取ります (出力)。
考えられる戻りコードは以下のとおりです。
  • CCI_SUCCESS
  • CCI_EXCEPTION
  • CCI_INV_PARSER_OBJECT
parser
パーサー・オブジェクトのアドレスを指定します (入力)。

戻り値

ルートの構文エレメントのアドレスが戻されます。 エラーが発生した場合は、ゼロ (CCI_NULL_ADDR) が戻され、returnCode がエラーの理由を示します。

サンプル

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

int cpiParseBufferEncoded(
  CciParser*     parser,
  CciContext* context,
  int            encoding,
  int         ccsid
){
  PARSER_CONTEXT_ST* pc = (PARSER_CONTEXT_ST *)context ;
  int                rc;

  /* Get a pointer to the message buffer and set the offset */
  pc->iBuffer = (void *)cpiBufferPointer(&rc, parser);
  pc->iIndex = 0;

  /* Save the format of the buffer */
  pc->iEncoding = encoding;
  pc->iCcsid = ccsid;

  /* Save size of the buffer */
  pc->iSize = cpiBufferSize(&rc, parser);

  /* Prime the first byte in the stream */
  pc->iCurrentCharacter = cpiBufferByte(&rc, parser, pc->iIndex);

  /* Set the current element to the root element */
  pc->iCurrentElement = cpiRootElement(&rc, parser);

  /* Reset flag to ensure parsing is reset correctly */
  pc->iInTag = 0;

  /* We will assume ownership of the remainder of the buffer */
  return(pc->iSize);
}
関連概念
ユーザー定義のパーサー
ユーザー定義拡張機能
関連タスク
C でのパーサーの作成
関連資料
C パーサー・ユーティリティー関数
特記事項 | 商標 | ダウンロード | ライブラリー | サポート | フィードバック
Copyright IBM Corporation 1999, 2006 最終更新: 08/21/2006
as08300_