cpiCreateAndInitializeElement

目的

構文ツリーに付加されていない、指定したパーサーが所有する構文エレメントを作成します。 このエレメントは、typenamefirstChildComplete、 および lastChildComplete パラメーターの値を使用して部分的に初期化されます。

構文

CciElement* cpiCreateAndInitializeElement(
  int*           returnCode,
  CciParser*     parser,
  CciElementType  type,
  const CciChar*  name,
  CciBool         firstChildComplete,
  CciBool         lastChildComplete);

パラメーター

returnCode
関数からの戻りコードを受け取ります (出力)。
考えられる戻りコードは以下のとおりです。
  • CCI_SUCCESS
  • CCI_EXCEPTION
  • CCI_FAILURE
  • CCI_INV_PARSER_OBJECT
parser
パーサー・オブジェクトのアドレスを指定します (入力)。 このアドレスは、cpiCreateContext インプリメンテーション関数のパラメーターとしてパーサーに渡されます。
type
作成するエレメントのタイプを指定します (入力)。
name
エレメントの記述名を指定します (入力)。
firstChildComplete
構文エレメントの firstChildComplete フラグの値を指定します (入力)。
lastChildComplete
構文エレメントの lastChildComplete フラグの値を指定します (入力)。

戻り値

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

サンプル

/* Advance to the end of the value */
          while (pc->iCurrentCharacter != quoteChar) {
            advance( (PARSER_CONTEXT_ST *)context, parser );
          }

          /* Get a pointer to the end of the tag */
          endMarker = (char*)pc->iBuffer+(int)pc->iIndex;

          /* Compute the size of the tag */
          markedSize = (size_t)endMarker-(int)startMarker;

          /* Convert the attribute value into broker form */
          data = CciNString((char *)startMarker, markedSize, pc->iCcsid);

          /* Create a new name-value element for the attribute */
          newElement = cpiCreateAndInitializeElement(&rc, parser, type, name);
          cpiSetElementType(&rc, newElement, CCI_ELEMENT_TYPE_NAME_VALUE);
          cpiSetElementName(&rc, newElement, data);
          if (pc->trace) {
            const char * mbData = mbString(data, pc->iCcsid);
            fprintf(pc->tracefile, "PLUGIN: Created new NAMEVALUE element;
                    object=0x%x type=0x%x name=",
                    newElement, CCI_ELEMENT_TYPE_NAME_VALUE);
            fprintf(pc->tracefile, "%s¥n", mbData);
            fflush(pc->tracefile);
            free((void *)mbData);
          }
          /* Free the memory created in CciNString() */
          free((void *)data);
関連概念
ユーザー定義のパーサー
ユーザー定義拡張機能
関連タスク
C でのパーサーの作成
関連資料
cpiCreateElement
C パーサー・ユーティリティー関数
特記事項 | 商標 | ダウンロード | ライブラリー | サポート | フィードバック
Copyright IBM Corporation 1999, 2006 最終更新: 08/21/2006
as08390_