Thursday, 20 February 2014

Creating XML Node Sets From A Delimited String In BPEL

Sometimes we need to create a custom node set from a delimited string value. The following is the one of the way to create the same.


  • Bring an Assign activity and add a create-nodeset-from-delimited-string function to the target node and put the parameters as mentioned below.
    • First parameter : qname (This is the element name which is generate from the deliminated string)
    • Second Parameter : Delimited String
    • Third Parameter : Delimiter
  • It will generate the number of delimited sting entities to the same number of first parameter element node set. 
  • We can copy the whole node set using copy list operation in an Assign activity.
  • In the below example the function generate the same number of result element node set as in the input parameter has the number of words separated by comma(,).
For Example : 


<assign name="AssignInput">
      <bpelx:copyList>
        <bpelx:from expression="oraext:create-nodeset-from-delimited-string('{http://xmlns.oracle.com/DelimitedStringDemo}result'
        ,bpws:getVariableData('inputVariable','payload','/client:process/client:input'),',')"/>
        <bpelx:to variable="outputVariable" part="payload"
                  query="/client:processResponse/client:result"/>
      </bpelx:copyList>
    </assign>


INPUT:

Output:




Also Check : Creating XML node srt from delimited string using Transaformation activity


Please give your valuable comment on this post. 
Happy Coding

4 comments:

  1. Hello Bibekananda,

    Can we create a custom node set from a delimited string value using BPEL transformations.

    Thanks.

    ReplyDelete
    Replies
    1. yes this is possible with BPEL transformations also but the thing is that there is no COPYLIST operation available with Transformation in front end xslt operations.

      Delete
    2. Hi Tina,

      As per your query we have posted the way through which we can create custom nodes from delimited string using transformation.You can check out

      http://bibeksoa.blogspot.in/2014/03/creating-xml-node-sets-from-delimited.html

      Delete
  2. Hello Bibekananda,
    I created a xsd in order to follow your example, but when I deploy and run the test appears the following error: "The element returned from the to-list spec at line 220 did not have an element parent."

    ReplyDelete