cniSearchElementInNamespace group

Searches for an element matching the specified criteria. The search starts at the syntax element specified in the element argument, and each of the four functions provides a search in a different tree direction:
  1. cniSearchFirstChildInNamespace searches the immediate child elements of the starting element from the first child, until either a match is found, or the end of the child element chain is reached.
  2. cniSearchLastChildInNamespace searches the immediate child elements of the starting element from the last child, until either a match is found, or the end of the child element chain is reached.
  3. cniSearchNextSiblingInNamespace searches from the starting element to the next siblings, until either a match is found, or the end of the sibling chain is reached.
  4. cniSearchPreviousSiblingInNamespace searches from the starting element to the previous siblings, until either a match is found, or the start of the sibling chain is reached.

This is used when searching a message that belongs to a namespace-aware domain.

Syntax

void cniSearchFirstChildInNamespace(
	int*           returnCode,
	CciElement*    targetElement,
	CciCompareMode mode,
	const CciChar* nameSpace,
	const CciChar* name,
	CciElementType type)		

void cniSearchLastChildInNamespace(
	int*           returnCode,
	CciElement*    targetElement,
	CciCompareMode mode,
	const CciChar* nameSpace,
	const CciChar* name,
	CciElementType type)		

void cniSearchNextSiblingInNamespace(
	int*           returnCode,
	CciElement*    targetElement,
	CciCompareMode mode,
	const CciChar* nameSpace,
	const CciChar* name,
	CciElementType type)		

void cniSearchPreviousSiblingInNamespace(
	int*           returnCode,
	CciElement*    targetElement,
	CciCompareMode mode,
	CciElementType type,
	const CciChar* nameSpace,
	const CciChar* name)		

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. The return code from the function (output).
Possible return codes are:
  • CCI_SUCCESS
  • CCI_EXCEPTION
  • CCI_INV_ELEMENT_OBJECT
targetElement
The address of the syntax element object from which the search starts (input).
mode
The search mode to use (input). This indicates what combination of element namespace, element name and element type is to be searched for. The possible values are:
  • CCI_COMPARE_MODE_SPACE
  • CCI_COMPARE_MODE_SPACE_FULL_TYPE
  • CCI_COMPARE_MODE_SPACE_GENERIC_TYPE
  • CCI_COMPARE_MODE_SPACE_SPECIFIC_TYPE
  • CCI_COMPARE_MODE_SPACE_NAME
  • CCI_COMPARE_MODE_SPACE_NAME_FULL_TYPE
  • CCI_COMPARE_MODE_SPACE_NAME_GENERIC_TYPE
  • CCI_COMPARE_MODE_SPACE_NAME_SPECIFIC_TYPE
  • CCI_COMPARE_MODE_NULL
When the compare mode does not involve a match on the namespace, all namespaces are searched. This is different behavior to that of the cniSearchElement group, where only the empty string namespace is searched. When you specify one of the above modes, set the nameSpace parameter to empty string.
type
The element type to search for (input). This is used only if the search mode involves a match on the type.
nameSpace
The namespace to search (input). This is used only if the search mode involves a match on the namespace.
name
The name to search for (input). This is used only if the search mode involves a match on the name.

Return values

None. If an error occurs, the returnCode parameter indicates the reason for the error.

Example

 mode=CCI_COMPARE_MODE_SPACE ;
 ...

   if (forward) {
      firstChild = cniSearchFirstChildInNamespace(&rc, element, mode, space, 0,0);
    }else{
      firstChild = cniSearchLastChildInNamespace(&rc, element, mode, space, 0,0);

    }

    if (firstChild) {
      depth++;
      traceElement(firstChild,forward,space);
      depth--;
    }
    currentElement = firstChild;
    do{

      if (forward) {
        nextSibling = cniSearchNextSiblingInNamespace(&rc, currentElement,mode,space,0,0);
      }else{
        nextSibling = cniSearchPreviousSiblingInNamespace(&rc, currentElement,mode,space,0,0);
      }
      if (nextSibling) {
        traceElement(nextSibling,forward,space);
        currentElement=nextSibling;
      }

    }while (nextSibling) ;
    
  }