Search code examples
osb

OSB Xquery to insert multiple elements after


I have a response from OSB service as below :

<cus:GetAllCustomersResponse  xmlns:cus="http://www.waai.nl/cdm/customer"> 
          <cus:customerId>1</cus:customerId> 
          <cus:customerName>2</cus:customerName> 
</cus:GetAllCustomersResponse> 

I want to insert several elements after customer name in the resposne in OSB proxy. I can do it through insert , but then i have to add 20 inserts if there are 20 elements. Can you please suggest if this can be done through Xquery in OSB proxy?

cus:GetAllCustomersResponse  xmlns:cus="http://www.waai.nl/cdm/customer"> 
          <cus:customerId>1</cus:customerId> 
          <cus:customerName>2</cus:customerName> 
          <cus:customerXXXXX>2</cus:customerXXXX> 
          <cus:customerXXYYY>2</cus:customerXXYYY>
          <cus:customerVVV>2</cus:customerVVV>
          <cus:customerBBB>2</cus:customerBBB>
          <cus:customerEEE>2</cus:customerEEE>
          ......
          ......
</cus:GetAllCustomersResponse> 

Thanks!!


Solution

  • Thanks Guys, got a simple way to do this through insert action. Insert after cus:customerName

      let $getAllCustomersResponse := 
      <GetAllCustomersResponse>
      <cus:customerXXXXX>2</cus:customerXXXX> 
      <cus:customerXXYYY>2</cus:customerXXYYY>
      <cus:customerVVV>2</cus:customerVVV>
       ............
       ............
    
      </GetAllCustomersResponse> 
      return
      $getAllCustomersResponse/*