Re: [Dev] Removing root element above an array in wso2. Please guide

2018-01-22 Thread Nadeeshaan Gunasinghe
Hi Vikram,

Can you try the following Payload factory config?


{"Detail":"$1"}

   



Cheers,

*Nadeeshaan Gunasinghe*
Senior Software Engineer, WSO2 Inc. http://wso2.com
+94770596754 | nadeesh...@wso2.com | Skype: nadeeshaan.gunasinghe <#>

 

Get your own email signature


On Mon, Jan 22, 2018 at 11:03 AM, Gihan Anuruddha  wrote:

> Have you tried something like this [1]? You need to add another XSLT
> processing after you get the original output.
>
> [1] - https://stackoverflow.com/questions/1571083/how-to-
> remove-root-element-from-xml-file
>
> Regards,
> Gihan
>
> On Mon, Jan 22, 2018 at 8:12 AM, Vinod Kavinda  wrote:
>
>> Hi Vikram,
>> This is happening because your XPath generates multiple elements with
>> below structure, which not your desired output.
>> **
>> * 26*
>> * box*
>> * 2019-01-17T00:00:00*
>> *  *
>>
>> In an XML point of view, you are expecting an xml content like below,
>> which is not a valid XML content since it does not have a root element. You
>> can test this with an online XPath evaluator and verify.
>>
>> * *
>> * 40*
>> * car*
>> * 2019-01-17T00:00:00*
>> * *
>> * *
>> * 37*
>> * table*
>> * 2019-01-17T00:00:00*
>> * *
>>
>>
>> I don't think you can achieve your requirement with the enrich mediator
>> since it only supports Xpaths. Please try using the Payload Factory
>> mediator[1] with Jsonpath. Then you can extract the "Detail" element from
>> the converted JSON and set it to the body.
>>
>> [1] - https://docs.wso2.com/display/EI611/PayloadFactory+Mediator
>>
>> On Sun, Jan 21, 2018 at 8:37 PM, vikram nayak 
>> wrote:
>>
>>>
>>>
>>> On Sunday, 21 January 2018 8:14 PM, vikram nayak 
>>> wrote:
>>>
>>>
>>> Hi All,,
>>>
>>> I have output like below from my xslt :
>>>
>>> 
>>> http://schemas.
>>> xmlsoap.org/soap/envelope/">
>>> 
>>> 
>>> 
>>> 40
>>> car
>>> 2019-01-17T00:00:00
>>> 
>>> 
>>> 37
>>> table
>>> 2019-01-17T00:00:00
>>> 
>>> 
>>> 35
>>> book
>>> 2019-01-17T00:00:00
>>> 
>>> 
>>> 26
>>> box
>>> 2019-01-17T00:00:00
>>> 
>>> 
>>> 
>>> 
>>>
>>> which gets converted into below json in postman :
>>>
>>> {
>>> "Result": {
>>> "Detail": [
>>> {
>>> "a": "40",
>>> "b": "car",
>>> "c": "2019-01-17T00:00:00"
>>> },
>>> {
>>> "a": "37",
>>> "b": "table",
>>> "c": "2019-01-17T00:00:00"
>>> },
>>> {
>>> "a": "35",
>>> "b": "book",
>>> "c": "2019-01-17T00:00:00"
>>> },
>>> {
>>> "a": "26",
>>> "b": "box",
>>> "c": "2019-01-17T00:00:00"
>>> }
>>> ]
>>> }
>>> }
>>>
>>> but in my desired output response . I do not want root element "Result".
>>>
>>> Desired output :
>>>
>>> {
>>> "Detail": [
>>> {
>>> "a": "40",
>>> "b": "car",
>>> "c": "2019-01-17T00:00:00"
>>> },
>>> {
>>> "a": "37",
>>> "b": "table",
>>> "c": "2019-01-17T00:00:00"
>>> },
>>> {
>>> "a": "35",
>>> "b": "book",
>>> "c": "2019-01-17T00:00:00"
>>> },
>>> {
>>> "a": "26",
>>> "b": "box",
>>> "c": "2019-01-17T00:00:00"
>>> }
>>> ]
>>> }
>>> }
>>>
>>> Going through some online documents I tried below enrich after xslt.
>>>
>>> 
>>> 
>>> 
>>> 
>>>
>>> But it gives only one element from my output  like below :
>>>
>>> {
>>> "Detail": {
>>> "insuranceNumber": "40",
>>> "policyName": "Laptop insurance - 4 star",
>>> "agreementValidTill": "2019-01-17T00:00:00"
>>> }
>>> }
>>>
>>> Please guide.
>>>
>>> Thanks,
>>> Vikram
>>>
>>>
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Vinod Kavinda
>> Senior Software Engineer
>> *WSO2 Inc. - lean . enterprise . middleware .*
>> Mobile : +94 (0) 712 415544
>> Blog : http://soatechflicks.blogspot.com/
>> [image: http://wso2.com/signature]
>> 
>>
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> W.G. Gihan Anuruddha
> Associate Technical Lead | WSO2, Inc.
> M: 

Re: [Dev] Removing root element above an array in wso2. Please guide

2018-01-21 Thread Gihan Anuruddha
Have you tried something like this [1]? You need to add another XSLT
processing after you get the original output.

[1] -
https://stackoverflow.com/questions/1571083/how-to-remove-root-element-from-xml-file

Regards,
Gihan

On Mon, Jan 22, 2018 at 8:12 AM, Vinod Kavinda  wrote:

> Hi Vikram,
> This is happening because your XPath generates multiple elements with
> below structure, which not your desired output.
> **
> * 26*
> * box*
> * 2019-01-17T00:00:00*
> *  *
>
> In an XML point of view, you are expecting an xml content like below,
> which is not a valid XML content since it does not have a root element. You
> can test this with an online XPath evaluator and verify.
>
> * *
> * 40*
> * car*
> * 2019-01-17T00:00:00*
> * *
> * *
> * 37*
> * table*
> * 2019-01-17T00:00:00*
> * *
>
>
> I don't think you can achieve your requirement with the enrich mediator
> since it only supports Xpaths. Please try using the Payload Factory
> mediator[1] with Jsonpath. Then you can extract the "Detail" element from
> the converted JSON and set it to the body.
>
> [1] - https://docs.wso2.com/display/EI611/PayloadFactory+Mediator
>
> On Sun, Jan 21, 2018 at 8:37 PM, vikram nayak 
> wrote:
>
>>
>>
>> On Sunday, 21 January 2018 8:14 PM, vikram nayak 
>> wrote:
>>
>>
>> Hi All,,
>>
>> I have output like below from my xslt :
>>
>> 
>> http://schemas.
>> xmlsoap.org/soap/envelope/">
>> 
>> 
>> 
>> 40
>> car
>> 2019-01-17T00:00:00
>> 
>> 
>> 37
>> table
>> 2019-01-17T00:00:00
>> 
>> 
>> 35
>> book
>> 2019-01-17T00:00:00
>> 
>> 
>> 26
>> box
>> 2019-01-17T00:00:00
>> 
>> 
>> 
>> 
>>
>> which gets converted into below json in postman :
>>
>> {
>> "Result": {
>> "Detail": [
>> {
>> "a": "40",
>> "b": "car",
>> "c": "2019-01-17T00:00:00"
>> },
>> {
>> "a": "37",
>> "b": "table",
>> "c": "2019-01-17T00:00:00"
>> },
>> {
>> "a": "35",
>> "b": "book",
>> "c": "2019-01-17T00:00:00"
>> },
>> {
>> "a": "26",
>> "b": "box",
>> "c": "2019-01-17T00:00:00"
>> }
>> ]
>> }
>> }
>>
>> but in my desired output response . I do not want root element "Result".
>>
>> Desired output :
>>
>> {
>> "Detail": [
>> {
>> "a": "40",
>> "b": "car",
>> "c": "2019-01-17T00:00:00"
>> },
>> {
>> "a": "37",
>> "b": "table",
>> "c": "2019-01-17T00:00:00"
>> },
>> {
>> "a": "35",
>> "b": "book",
>> "c": "2019-01-17T00:00:00"
>> },
>> {
>> "a": "26",
>> "b": "box",
>> "c": "2019-01-17T00:00:00"
>> }
>> ]
>> }
>> }
>>
>> Going through some online documents I tried below enrich after xslt.
>>
>> 
>> 
>> 
>> 
>>
>> But it gives only one element from my output  like below :
>>
>> {
>> "Detail": {
>> "insuranceNumber": "40",
>> "policyName": "Laptop insurance - 4 star",
>> "agreementValidTill": "2019-01-17T00:00:00"
>> }
>> }
>>
>> Please guide.
>>
>> Thanks,
>> Vikram
>>
>>
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Vinod Kavinda
> Senior Software Engineer
> *WSO2 Inc. - lean . enterprise . middleware .*
> Mobile : +94 (0) 712 415544
> Blog : http://soatechflicks.blogspot.com/
> [image: http://wso2.com/signature]
> 
>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
W.G. Gihan Anuruddha
Associate Technical Lead | WSO2, Inc.
M: +94772272595
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Removing root element above an array in wso2. Please guide

2018-01-21 Thread Vinod Kavinda
Hi Vikram,
This is happening because your XPath generates multiple elements with below
structure, which not your desired output.
**
* 26*
* box*
* 2019-01-17T00:00:00*
*  *

In an XML point of view, you are expecting an xml content like below, which
is not a valid XML content since it does not have a root element. You can
test this with an online XPath evaluator and verify.

* *
* 40*
* car*
* 2019-01-17T00:00:00*
* *
* *
* 37*
* table*
* 2019-01-17T00:00:00*
* *


I don't think you can achieve your requirement with the enrich mediator
since it only supports Xpaths. Please try using the Payload Factory
mediator[1] with Jsonpath. Then you can extract the "Detail" element from
the converted JSON and set it to the body.

[1] - https://docs.wso2.com/display/EI611/PayloadFactory+Mediator

On Sun, Jan 21, 2018 at 8:37 PM, vikram nayak 
wrote:

>
>
> On Sunday, 21 January 2018 8:14 PM, vikram nayak 
> wrote:
>
>
> Hi All,,
>
> I have output like below from my xslt :
>
> 
> http://schemas.xmlsoap.org/soap/envelope/
> ">
> 
> 
> 
> 40
> car
> 2019-01-17T00:00:00
> 
> 
> 37
> table
> 2019-01-17T00:00:00
> 
> 
> 35
> book
> 2019-01-17T00:00:00
> 
> 
> 26
> box
> 2019-01-17T00:00:00
> 
> 
> 
> 
>
> which gets converted into below json in postman :
>
> {
> "Result": {
> "Detail": [
> {
> "a": "40",
> "b": "car",
> "c": "2019-01-17T00:00:00"
> },
> {
> "a": "37",
> "b": "table",
> "c": "2019-01-17T00:00:00"
> },
> {
> "a": "35",
> "b": "book",
> "c": "2019-01-17T00:00:00"
> },
> {
> "a": "26",
> "b": "box",
> "c": "2019-01-17T00:00:00"
> }
> ]
> }
> }
>
> but in my desired output response . I do not want root element "Result".
>
> Desired output :
>
> {
> "Detail": [
> {
> "a": "40",
> "b": "car",
> "c": "2019-01-17T00:00:00"
> },
> {
> "a": "37",
> "b": "table",
> "c": "2019-01-17T00:00:00"
> },
> {
> "a": "35",
> "b": "book",
> "c": "2019-01-17T00:00:00"
> },
> {
> "a": "26",
> "b": "box",
> "c": "2019-01-17T00:00:00"
> }
> ]
> }
> }
>
> Going through some online documents I tried below enrich after xslt.
>
> 
> 
> 
> 
>
> But it gives only one element from my output  like below :
>
> {
> "Detail": {
> "insuranceNumber": "40",
> "policyName": "Laptop insurance - 4 star",
> "agreementValidTill": "2019-01-17T00:00:00"
> }
> }
>
> Please guide.
>
> Thanks,
> Vikram
>
>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Vinod Kavinda
Senior Software Engineer
*WSO2 Inc. - lean . enterprise . middleware .*
Mobile : +94 (0) 712 415544
Blog : http://soatechflicks.blogspot.com/
[image: http://wso2.com/signature]

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


Re: [Dev] Removing root element above an array in wso2. Please guide

2018-01-21 Thread vikram nayak
 

On Sunday, 21 January 2018 8:14 PM, vikram nayak  
wrote:
 

 Hi All,,
I have output like below from my xslt :
http://schemas.xmlsoap.org/soap/envelope/;>  
  40 car 2019-01-17T00:00:00  
 37 table 2019-01-17T00:00:00   
35 book 2019-01-17T00:00:00   26 
box 2019-01-17T00:00:00   

which gets converted into below json in postman :
{    "Result": {        "Detail": [            {                "a": "40",      
          "b": "car",                "c": "2019-01-17T00:00:00"            },   
         {                "a": "37",                "b": "table",               
 "c": "2019-01-17T00:00:00"            },            {                "a": 
"35",                "b": "book",                "c": "2019-01-17T00:00:00"     
       },            {                "a": "26",                "b": "box",     
           "c": "2019-01-17T00:00:00"            }        ]    }}
but in my desired output response . I do not want root element "Result".
Desired output :
{    "Detail": [            {                "a": "40",                "b": 
"car",                "c": "2019-01-17T00:00:00"            },            {     
           "a": "37",                "b": "table",                "c": 
"2019-01-17T00:00:00"            },            {                "a": "35",      
          "b": "book",                "c": "2019-01-17T00:00:00"            },  
          {                "a": "26",                "b": "box",                
"c": "2019-01-17T00:00:00"            }        ]    }}
Going through some online documents I tried below enrich after xslt.
          
But it gives only one element from my output  like below :
{    "Detail": {        "insuranceNumber": "40",        "policyName": "Laptop 
insurance - 4 star",        "agreementValidTill": "2019-01-17T00:00:00"    }}
Please guide.
Thanks,Vikram

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


[Dev] Removing root element above an array in wso2. Please guide

2018-01-21 Thread vikram nayak
Hi All,,
I have output like below from my xslt :
http://schemas.xmlsoap.org/soap/envelope/;>  
  40 car 2019-01-17T00:00:00  
 37 table 2019-01-17T00:00:00   
35 book 2019-01-17T00:00:00   26 
box 2019-01-17T00:00:00   

which gets converted into below json in postman :
{    "Result": {        "Detail": [            {                "a": "40",      
          "b": "car",                "c": "2019-01-17T00:00:00"            },   
         {                "a": "37",                "b": "table",               
 "c": "2019-01-17T00:00:00"            },            {                "a": 
"35",                "b": "book",                "c": "2019-01-17T00:00:00"     
       },            {                "a": "26",                "b": "box",     
           "c": "2019-01-17T00:00:00"            }        ]    }}
but in my desired output response . I do not want root element "Result".
Desired output :
{    "Detail": [            {                "a": "40",                "b": 
"car",                "c": "2019-01-17T00:00:00"            },            {     
           "a": "37",                "b": "table",                "c": 
"2019-01-17T00:00:00"            },            {                "a": "35",      
          "b": "book",                "c": "2019-01-17T00:00:00"            },  
          {                "a": "26",                "b": "box",                
"c": "2019-01-17T00:00:00"            }        ]    }}
Going through some online documents I tried below enrich after xslt.
          
But it gives only one element from my output  like below :
{    "Detail": {        "insuranceNumber": "40",        "policyName": "Laptop 
insurance - 4 star",        "agreementValidTill": "2019-01-17T00:00:00"    }}
Please guide.
Thanks,Vikram___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev