cniElementValue 组

这些函数检索指定的语法元素的值。

语法

CciSize cniElementBitArrayValue(
    int*                returnCode,
    CciElement*               targetElement,
    const struct CciBitArray* value);
CciBool cniElementBooleanValue(
    int*                returnCode,
    CciElement*    targetElement);
CciSize cniElementByteArrayValue(
    int*                returnCode,
    CciElement*               targetElement,
    const struct CciByteArray* value);
CciSize cniElementCharacterValue(
    int*                returnCode,
    CciElement*               targetElement,
    const CciChar*             value,
    CciSize                    length);
struct CciDate cniElementDateValue(
    int*                returnCode,
    CciElement*    targetElement);
CciSize cniElementDecimalValue(
    int*                returnCode,
    CciElement*               targetElement,
    const CciChar*             value,
    CciSize                    length);
struct CciTimestamp cniElementGmtTimestampValue(
    int*                returnCode,
    CciElement*    targetElement);
struct CciTime cniElementGmtTimeValue(
    int*                returnCode,
    CciElement*    targetElement);
CciInt cniElementIntegerValue(
    int*                returnCode,
    CciElement*    targetElement);
CciReal cniElementRealValue(
    int*                returnCode,
    CciElement*    targetElement);
struct CciTimestamp cniElementTimestampValue(
    int*                returnCode,
    CciElement*    targetElement);
struct CciTime cniElementTimeValue(
    int*                returnCode,
    CciElement*    targetElement);

参数

returnCode
来自函数(输出)的返回码。
可能的返回码是:
  • CCI_SUCCESS
  • CCI_EXCEPTION
  • CCI_INV_ELEMENT_OBJECT
  • CCI_INV_DATA_POINTER
  • CCI_INV_DATA_BUFLEN
  • CCI_INV_BUFFER_TOO_SMALL
targetElement
目标语法元素对象(输入)的地址。
value
存储语法元素的值的输出缓冲区的地址(输入)。仅用于相关函数调用。
length
输出缓冲区的长度,以字符为单位,由参数指定(输入)。仅用于相关函数调用。

返回值

  • 如果成功,返回目标元素的值。
  • 如果元素数据的大小可以改变,则会返回正确的数据大小。
  • 如果指定的长度太小,则错误代码设置为 CCI_BUFFER_TOO_SMALL。
  • 如果发生错误,则 returnCode 参数表明错误原因。

示例

     numberOfChars     = cniElementCharacterValue(
		 		 &rc, firstChild, (CciChar*)&elementValue, sizeof(elementValue)
		 		 );

if (rc==CCI_BUFFER_TOO_SMALL) {
        free(elementValue);
        elementValue      = (CciChar*)malloc(numberOfChars * sizeof(CciChar));
        numberOfChars     = cniElementCharacterValue(
                                    &rc, firstChild, (CciChar*)&elementValue, sizeof(elementValue));
  }
声明 | 商标 | 下载 | 书库 | 支持 | 反馈
Copyright IBM Corporation 1999, 2006 最后一次更新时间:2006/08/14
as07910_