cpiAddAsLastChild
This function adds a new (and currently unattached) syntax element to the syntax element tree as the last child of the specified target element.
Syntax
void cpiAddAsLastChild(
int* returnCode,
CciElement* targetElement,
CciElement* newElement);
Parameters
- returnCode
- Receives the return code from the function (output). Possible return codes are:
- CCI_SUCCESS
- CCI_EXCEPTION
- CCI_INV_ELEMENT_OBJECT
- targetElement
- Specifies the address of the target syntax element object (input).
- newElement
- Specifies the address of the new syntax element object that is to be added to the tree structure (input).
Return values
None. If an error occurs, returnCode indicates the reason for the error.
Sample
This example is taken from the sample parser file BipSampPluginParser.c:
/* Convert the attribute value into integration node 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);
/* Free the memory created in CciNString() */
free((void *)data);
/* Add the element */
cpiAddAsLastChild(&rc, element, newElement);