WebSphere Message Brokers
File: as07742_
Writer: Lorraine Waitt

Reference topic

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

cniElementNamespace

Gets the value of the namespace attribute for the specified syntax element. The syntax element name will have been set previously using cniSetElementNamespace or cpiSetElementNamespace.

This is used when converting a message that belongs to a namespace-aware domain to a bit stream.

Syntax

CciSize cniElementNamespace(
	int*           returnCode,
	CciElement*    targetElement,
	const CciChar* value,
	CciSize        length)		

Parameters

returnCode
The return code from the function (output). Specifying a NULL pointer signifies that the node does not want to deal with errors. If input is not NULL, the output signifies the success status of the call. Any exceptions thrown during the execution of this call are re-thrown to the next upstream node in the flow. Call cciGetLastExceptionData for details of the exception.
Possible return codes are:
  • CCI_SUCCESS
  • CCI_EXCEPTION
  • CCI_INV_ELEMENT_OBJECT
  • CCI_INV_DATA_POINTER
  • CCI_INV_DATA_BUFLEN
  • CCI_INV_BUFFER_TOO_SMALL
targetElement
Specifies the address of the target syntax element object (input).
value
Specifies the address of a buffer into which the element namespace value is copied (output). A string of characters (including a NULL terminator) representing the namespace value is copied into this buffer. The buffer should be a portion of memory previously allocated by the caller.
length
The length, in characters, of the buffer specified by the value parameter (input).

Return values

  • If successful, the number of CciChars copied into the buffer is returned.
  • If the buffer is not large enough to contain the attribute value, returnCode is set to CCI_BUFFER_TOO_SMALL, and the number of CciChars required is returned.
  • If an exception occurs during execution, returnCode is set to CCI_EXCEPTION.

Example

 if (element != 0) {
    /*get name*/
    cniElementName(&rc, element, (CciChar*)&elementName, sizeof(elementName));

    /*get namespace*/
    elementNamespace=(CciChar*)malloc(sizeof(CciChar) * elementNamespaceLength);
    elementNamespaceLength = cniElementNamespace(&rc,
                                                 element,
                                                 elementNamespace,
                                                 elementNamespaceLength);
    
    if (rc==CCI_BUFFER_TOO_SMALL){
      free(elementNamespace);
      elementNamespace=(CciChar*)malloc(sizeof(CciChar) * elementNamespaceLength);
      elementNamespaceLength = cniElementNamespace(&rc,
                                                   element,
                                                   elementNamespace,
                                                   elementNamespaceLength);
    }
    checkRC(rc);
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:28

as07742_ This topic's URL is: