Re: [Dev] Transform an xml with payload factory and xpath

2016-11-02 Thread Jagath Sisirakumara Ariyarathne
Hi Bhathiya,

If the number of  elements are static, we can use below config.



http://service.ws.um.carbon.wso2.org;>
$1
$2



http://service.ws.um.carbon.wso2.org"/>
http://service.ws.um.carbon.wso2.org"/>



Otherwise you might need to use XSLT transformation.

Thanks.

On Sun, Oct 30, 2016 at 11:33 PM, Bhathiya Jayasekara 
wrote:

> Hi devs,
>
> I have below XML in the message context.
>
> http://schemas.xmlsoap.org/soap/envelope/
> ">
>
>   <*ns:getUserListOfRoleResponse* xmlns:ns="http://service.ws.
> um.carbon.wso2.org">
>  usersx
>  doctor
>   
>
> 
>
> Is it possible to transform this to below one, just with a payload factory
> (and xpath)?
>
>   <*ns:results* xmlns:ns="http://service.ws.um.carbon.wso2.org;>
>  usersx
>  doctor
>   
>
> Basically what I tried is this with different xpaths, but none of them
> gave me the expected output.
>
>  
> 
>$1
> 
> 
>http://service.ws.um.carbon.wso2.org;
> evaluator="xml" *expression="//ns:getUserListOfRoleResponse/node()"*/>
> 
>  
>
> Appreciate your help.
>
> Thanks,
>
> --
> *Bhathiya Jayasekara*
> *Senior Software Engineer,*
> *WSO2 inc., http://wso2.com *
>
> *Phone: +94715478185 <%2B94715478185>*
> *LinkedIn: http://www.linkedin.com/in/bhathiyaj
> *
> *Twitter: https://twitter.com/bhathiyax *
> *Blog: http://movingaheadblog.blogspot.com
> *
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Jagath Ariyarathne
Technical Lead
WSO2 Inc.  http://wso2.com/
Email: jaga...@wso2.com
Mob  : +94 77 386 7048

___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Transform an xml with payload factory and xpath

2016-11-01 Thread Bhathiya Jayasekara
Hi Jagath,

Thanks for the reply. The number of  elements are dynamic. I'll go
with XSLT then.

Thanks,
Bhathiya

On Wed, Nov 2, 2016 at 9:46 AM, Jagath Sisirakumara Ariyarathne <
jaga...@wso2.com> wrote:

> Hi Bhathiya,
>
> If the number of  elements are static, we can use below config.
>
> 
> 
> http://service.ws.um.carbon.wso2.org;>
> $1
> $2
> 
> 
> 
>  expression="//ns:getUserListOfRoleResponse/ns:return[1]"
> xmlns:ns="http://service.ws.um.carbon.wso2.org"/>
>  expression="//ns:getUserListOfRoleResponse/ns:return[2]"
> xmlns:ns="http://service.ws.um.carbon.wso2.org"/>
> 
> 
>
> Otherwise you might need to use XSLT transformation.
>
> Thanks.
>
> On Sun, Oct 30, 2016 at 11:33 PM, Bhathiya Jayasekara 
> wrote:
>
>> Hi devs,
>>
>> I have below XML in the message context.
>>
>> http://schemas.
>> xmlsoap.org/soap/envelope/">
>>
>>   <*ns:getUserListOfRoleResponse* xmlns:ns="http://service.ws.um
>> .carbon.wso2.org">
>>  usersx
>>  doctor
>>   
>>
>> 
>>
>> Is it possible to transform this to below one, just with a payload
>> factory (and xpath)?
>>
>>   <*ns:results* xmlns:ns="http://service.ws.um.carbon.wso2.org;>
>>  usersx
>>  doctor
>>   
>>
>> Basically what I tried is this with different xpaths, but none of them
>> gave me the expected output.
>>
>>  
>> 
>>$1
>> 
>> 
>>http://service.ws.um.carbon.wso2.org;
>> evaluator="xml" *expression="//ns:getUserListOfRoleResponse/node()"*/>
>> 
>>  
>>
>> Appreciate your help.
>>
>> Thanks,
>>
>> --
>> *Bhathiya Jayasekara*
>> *Senior Software Engineer,*
>> *WSO2 inc., http://wso2.com *
>>
>> *Phone: +94715478185 <%2B94715478185>*
>> *LinkedIn: http://www.linkedin.com/in/bhathiyaj
>> *
>> *Twitter: https://twitter.com/bhathiyax *
>> *Blog: http://movingaheadblog.blogspot.com
>> *
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Jagath Ariyarathne
> Technical Lead
> WSO2 Inc.  http://wso2.com/
> Email: jaga...@wso2.com
> Mob  : +94 77 386 7048
> 
>



-- 
*Bhathiya Jayasekara*
*Senior Software Engineer,*
*WSO2 inc., http://wso2.com *

*Phone: +94715478185*
*LinkedIn: http://www.linkedin.com/in/bhathiyaj
*
*Twitter: https://twitter.com/bhathiyax *
*Blog: http://movingaheadblog.blogspot.com
*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Transform an xml with payload factory and xpath

2016-10-30 Thread Bhathiya Jayasekara
Hi devs,

I have below XML in the message context.

http://schemas.xmlsoap.org/soap/envelope/;>
   
  <*ns:getUserListOfRoleResponse* xmlns:ns="
http://service.ws.um.carbon.wso2.org;>
 usersx
 doctor
  
   


Is it possible to transform this to below one, just with a payload factory
(and xpath)?

  <*ns:results* xmlns:ns="http://service.ws.um.carbon.wso2.org;>
 usersx
 doctor
  

Basically what I tried is this with different xpaths, but none of them gave
me the expected output.

 

   $1


   http://service.ws.um.carbon.wso2.org;
evaluator="xml" *expression="//ns:getUserListOfRoleResponse/node()"*/>

 

Appreciate your help.

Thanks,

-- 
*Bhathiya Jayasekara*
*Senior Software Engineer,*
*WSO2 inc., http://wso2.com *

*Phone: +94715478185*
*LinkedIn: http://www.linkedin.com/in/bhathiyaj
*
*Twitter: https://twitter.com/bhathiyax *
*Blog: http://movingaheadblog.blogspot.com
*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev