cpiSetNameFromBuffer

用途

使用 name 参数指向的缓冲区中提供的数据设置目标语法元素的名称属性。名称的大小使用 lgenth 参数指定。

语法

void cpiSetNameFromBuffer(
    int*                returnCode,
    CciElement*               targetElement,
  	const CciChar* name,
    CciSize                    length);

参数

returnCode
接收来自函数(输出)的返回码。
可能的返回码是:
  • CCI_SUCCESS
  • CCI_EXCEPTION
  • CCI_INV_ELEMENT_OBJECT
  • CCI_INV_DATA_POINTER
  • CCI_INV_DATA_BUFLEN
targetElement
指定目标语法元素对象(输入)的地址。
name
包含名称的缓冲区的地址(输入)。
length
CciChar 字符的个数表示的字符串的长度使用名称参数指定。

返回值

无。 如果发生错误,则 returnCode 表明错误原因。

样本

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

          /* Create a new name-value element for the attribute */
                  newElement = cpiCreateElement(&rc, parser);
                    cpiSetElementType(&rc, newElement, CCI_ELEMENT_TYPE_NAME_VALUE);
                    cpiSetNameFromBuffer(&rc, newElement, data, length);
          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);
                  /* Add the element */
                    cpiAddAsLastChild(&rc, element, newElement);
相关概念
用户定义的解析器
用户定义的扩展
相关任务
使用 C 创建解析器
相关参考
C 解析器实用程序函数
声明 | 商标 | 下载 | 书库 | 支持 | 反馈
Copyright IBM Corporation 1999, 2006 最后一次更新时间:2006/08/14
as08540_