Creates a modifiable SqlPathExpression object that represents the path specified by the path argument. Modifiable means that when navigated, path elements will be created if they do not already exist. This function returns a pointer to the PathExpression object which is used as input to the functions that navigate the path, namely the cniSqlNavigatePath family. There is an overhead involved in creating the expression so if the same path expression is to be used for every message then this function should be called once and the CciSqlPathExpression* that is returned should used in a call to cniSqlNavigate for each message. It is possible to use the CciSqlPathExpression on a different thread than it was created.
CciSqlPathExpression* cniSqlCreateModifiablePathExpression( int* returnCode, CciNode* nodeObject, CciChar* dataSourceName, CciChar* path);
If successful, the address of the SQLPathExpression object is returned. If an error occurs, CCI_NULL_ADDR is returned and the return code parameter indicates the reason for the error. Once the SQLPathExpression is no longer needed, (typically when the node is deleted) it should be deleted by calling cniSqlDeletePathExpression.
By adding the following code to the Transform node sample we could easily create an element, and all necessary ancestor elements with one function call.
We create the CciSQLPathExpression in the _Transform_createNodeContext function:
{ CciChar ucsPathExpressionString[32]; char* mbPathExpressionString = "OutputRoot.XML.Request.A.B.C.D.E"; /* convert our path string to unicode*/ cciMbsToUcs(NULL, mbPathExpressionString, ucsPathExpressionString, 32, BIP_DEF_COMP_CCSID); p->pathExpression = cniSqlCreateModifiablePathExpression( NULL, nodeObject, NULL,/*we do not reference Database*/ ucsPathExpressionString); }
and we can then use this CciSqlPathExpression later in the _Transform_evaluate function
{ CciElement* newElement = cniSqlNavigatePath( NULL, ((NODE_CONTEXT_ST *)context)->pathExpression, message, destinationList, exceptionList, outMsg, NULL,/*we do not reference OutputLocalEnvironment*/ NULL/*we do not reference OutputLExceptionList*/); }
So passing in the input message PluginSample.change.xml:
<Request type="change"> <CustomerAccount>01234567</CustomerAccount> <CustomerPhone>555-0000</CustomerPhone> </Request>
we would see the following output message.
<Request type="modify"> <CustomerAccount>01234567</CustomerAccount> <CustomerPhone>555-0000</CustomerPhone> <A> <B> <C> <D/> </C> </B> </A> </Request>
Notices |
Trademarks |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
as08032_ |