경로 인수에 지정된 경로를 나타내는 수정 가능한 SqlPathExpression 오브젝트를 작성합니다. 수정 가능하다는 것은 탐색할 때 존재하지 않는 경로 요소가 작성된다는 뜻입니다. 이 함수는 경로를 탐색하는 함수의 입력으로 사용되는 PathExpression 오브젝트(즉, cniSqlNavigatePath 제품군)로 포인터를 돌려보냅니다. 표현식 작성과 관련된 오버헤드가 있으므로 같은 경로 표현식이 모든 메시지에 사용될 경우 이 함수를 한 번 호출해야 하며 리턴한 CciSqlPathExpression*은 각 메시지의 cniSqlNavigate 호출에 사용해야 합니다. 작성되지 않은 다른 스레드에서 CciSqlPathExpression*을 사용할 수 있습니다.
CciSqlPathExpression* cniSqlCreateModifiablePathExpression( int* returnCode, CciNode* nodeObject, CciChar* dataSourceName, CciChar* path);
성공할 경우 SQLPathExpression 오브젝트의 주소가 리턴됩니다. 오류가 발생하면 CCI_NULL_ADDR이 리턴되고 리턴 코드 매개변수가 오류의 원인을 표시합니다. SQLPathExpression이 더 이상 필요하지 않은 경우(일반적으로 노드가 삭제될 때) cniSqlDeletePathExpression을 호출하여 삭제해야 합니다.
다음 코드를 Transform 노드 샘플에 추가하면 하나의 함수 호출로 요소 및 필요한 모든 상위 요소를 쉽게 작성할 수 있습니다.
_Transform_createNodeContext 함수에 CciSQLPathExpression을 작성합니다.
{ 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); }
그런 다음 나중에 _Transform_evaluate 함수에서 이 CciSqlPathExpression을 사용할 수 있습니다.
{ 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*/); }
그러므로 입력 메시지 PluginSample.change.xml로 전달하면
<Request type="change"> <CustomerAccount>01234567</CustomerAccount> <CustomerPhone>555-0000</CustomerPhone> </Request>
다음과 같은 출력 메시지가 표시됩니다.
<Request type="modify"> <CustomerAccount>01234567</CustomerAccount> <CustomerPhone>555-0000</CustomerPhone> <A> <B> <C> <D/> </C> </B> </A> </Request>