cpiElementNameSpace

Purpose

Gets 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 plug-in node does not want 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. If the caller did not allocate enough memory to hold the namespace value, *returncode is set to CCI_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 will be copied. A string of characters (including a NULL terminator) representing the namesapce value is copied into this buffer. The buffer should be a portion of memory previously allocated by the caller
length
The length in bytes 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 was not large enough to contain the namespace value, the number of bytes required is returned (and returnCode is set to CCI_BUFFER_TOO_SMALL).

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);

Related concepts
User-defined parsers
User-defined extensions

Related tasks
Creating a parser in C

Related reference
cpiSetElementNamespace
Parser implementation functions