cpiRootElement

목적

지정된 구문 분석기 오브젝트의 루트 구문 요소 주소를 가져옵니다.

구문

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

매개변수

returnCode
함수의 리턴 코드를 수신합니다(출력).
가능한 리턴 코드는 다음과 같습니다.
  • CCI_SUCCESS
  • CCI_EXCEPTION
  • CCI_INV_PARSER_OBJECT
parser
구문 분석기 오브젝트의 주소를 지정합니다(입력).

리턴 값

루트 구문 요소의 주소가 리턴됩니다. 오류가 발생하면, 0(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 마지막 갱신 날짜: 2006/08/21
as08300_