cpiElementNameSpace

This function retrieves the value of the namespace attribute for the specified syntax element.

Defined In Type Member
CPI_VFT Optional iFpElementValue

Syntax

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

Parameters

returnCode
A NULL pointer input signifies that the user-defined node does not want to deal with errors. All exceptions thrown during the execution of this call are re-thrown to the next upstream node in the flow. If input is not NULL, output signifies the success status of the call. If an exception occurs during execution, *returnCode is set to CCI_EXCEPTION on output. You can call CciGetLastExceptionData to get details of the exception. If the caller did not allocate enough memory to hold the namespace value, *returncode is set to CCI_BUFFER_TOO_SMALL.
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.
value
Specifies the address of a buffer into which the element namespace value is copied. A string of characters (including a NULL terminator) representing the namespace value is copied into this buffer. The buffer must be a portion of memory previously allocated by the caller.
length
The length in CciChars of the buffer specified by the value parameter.

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 bytes CciChars required is returned.

Sample

elementNamespace=(CciChar*)malloc(sizeof(CciChar) * elementNamespaceLength);
    elementNamespaceLength = cpiElementNamespace(&rc;,
                        element,
                        elementNamespace,
                        elementNamespaceLength);
    
    if (rc==CCI_BUFFER_TOO_SMALL){
      free(elementNamespace);
      elementNamespace=(CciChar*)malloc(sizeof(CciChar) * elementNamespaceLength);
      elementNamespaceLength = cpiElementNamespace(&rc;,
                        element,
                        elementNamespace,
                        elementNamespaceLength);
    }
    checkRC(rc);