WebSphere Message Brokers
File: as08185_
Writer: Lorraine Waitt

Reference topic

This build: July 31, 2007 21:37:58

cpiSetElementNamespace

Purpose

Sets the "namespace" attribute for the specified syntax element.

Defined In Type Member
CPI_VFT Optional iFpSetElementValue

Syntax

void             cpiSetElementNamespace(
		int*            returnCode,
		CciElement*     targetElement,
		const CciChar*  nameSpace);

Parameters

returnCode
A NULL pointer input signifies that the user-defined node does not wish to deal with errors. Any exceptions thrown during the execution of this call will be re-thrown to the next upstream node in the flow. If input is not NULL, output will signify the success status of the call. If an exception occurs during execution, *returnCode will be set to CCI_EXCEPTION on output. A call to CciGetLastExceptionData will provide details of the exception. (input).
Possible return codes are:
  • CCI_SUCCESS
  • CCI_EXCEPTION
  • CCI_INV_ELEMENT_OBJECT
  • CCI_INV_DATA_POINTER
currentElement
The address of the current syntax element (input).
targetElement
Specifies the address of the target syntax element object.
value
Specifies the address of a null terminated string of CciChars representing the namespace value. An empty string is a valid value for namespace. In fact, elements are created in the empty string namespace by default so specifying an empty string as the namespace via this API will only have any effect if the element was previously in another namespace and the desired effect is to change the namespace value to empty string.

Return values

None.

Sample

/* 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);
          cpiSetElementName(&rc, newElement, data);
          cpiSetElementNamespace(&rc, newElement, data);
          if (pc->trace) {
            const char * mbData = mbString(data, pc->iCcsid);
            fprintf(pc->tracefile, "PLUGIN: Created new NAMESPACEVALUE 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);
Related concepts
User-defined parsers
User-defined extensions overview
Related tasks
Creating a parser in C
Related reference
cpiElementNameSpace
C parser implementation functions
Notices | Trademarks | Downloads | Library | Support | Feedback

Copyright IBM Corporation 1999, 2007Copyright IBM Corporation 1999, 2007. All Rights Reserved.
This build: July 31, 2007 21:37:58

as08185_ This topic's URL is: