cpiParent

목적

지정된 대상 요소의 상위 오브젝트인 구문 요소 오브젝트의 주소를 리턴합니다.

구문

CciElement* cpiParent(
  int*                   returnCode,
  const CciElement*  targetElement);

매개변수

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

리턴 값

함수가 정상적으로 실행되면, 요청된 구문 요소의 주소가 리턴됩니다. 상위 요소가 없으면, 0이 리턴됩니다. 오류가 발생하면, 0(CCI_NULL_ADDR)이 리턴되고 returnCode 매개변수는 오류의 이유를 표시합니다.

샘플

다음 예는 샘플 구문 분석기 파일 BipSampPluginParser.c에서 발췌한 것입니다(116 - 173행).

void* parseNextItem(
  CciParser*      parser,
  CciContext* context,
  CciElement* element
){
  void*              endMarker;
  void*              startMarker;
  PARSER_CONTEXT_ST* pc = (PARSER_CONTEXT_ST *)context;
  CciElement*        returnElement = element;
  CciElement*        newElement;
  size_t             markedSize;
  const CciChar*     data;
  int                rc;
if (pc->trace) 
  /* Skip any white space */
  skipWhiteSpace( (PARSER_CONTEXT_ST *)context );
  /* Are we at the end of the buffer? */
  if (pc->iIndex == pc->iSize)
        return(0);
}
  /* Are we within a tag? */
  if (pc->iInTag) {
if (pc->iCurrentCharacter == chCloseAngle) {
      /* We have reached the end of a tag */
pc->iInTag = 0;
            advance( (PARSER_CONTEXT_ST *)context, parser );
}
else if (pc->iCurrentCharacter == chForwardSlash) {
      /* We may have reached the end of an empty tag */
            advance( (PARSER_CONTEXT_ST *)context, parser );
if (pc->iCurrentCharacter == chCloseAngle) {
pc->iInTag = 0;
            advance( (PARSER_CONTEXT_ST *)context, parser );
        cpiSetElementCompleteNext(&rc, element, 1);
        returnElement = cpiParent(&rc, element);
}
관련 개념
사용자 정의 구문 분석기
사용자 정의 확장 구성요소
관련 태스크
C로 구문 분석기 작성
관련 참조
C 구문 분석기 유틸리티 함수
주의사항 | 등록상표 | 다운로드 | 라이브러리 | 지원 | 피드백
Copyright IBM Corporation 1999, 2006 마지막 갱신 날짜: 5월 12, 2006
as08310_