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

Tuesday, 18 February 2014

Shell Script to Replace A String In A File

Use the following shell script command to search and override all the occurrences of a search string with a replacement string.
  • sed -i 's/searchString/'replaceString'/g' fileName.ext

Shell Script To Count Number Of Files In A Directory & Subdirectories

Execute the below script to find number of xml files are there within a directory and sub directory.

  • find . -type f -name "*.xml" | wc -l
To Count Number of files which are not xml files execute the following command : 
  • find . -type f  ! -name "*PG.xml" | wc -l 
To Count number of total files in a directory and sub directories execute the following command: 
  • find ./ -type f | wc -l