Re: [Dev] Xpath expression to fetch a property which has space in name

2016-05-11 Thread Praneesha Chandrasiri
hi Rajith,

I added the above information under a topic named "Converting spaces" in
docs of ESB 4.9.0 and above, as for example in [1].

Also, I added a comment in the JIRA in [2].

Thanks for the support!

[1]
https://docs.wso2.com/display/ESB500/JSON+Support#JSONSupport-ConvertingapayloadbetweenXMLandJSON
[2] https://wso2.org/jira/browse/ESBJAVA-4492

On Wed, May 11, 2016 at 10:22 AM, Rajith Vitharana  wrote:

> Hi All,
>
> This can be avoided by using "synapse.commons.json.buildValidNCNames" to
> value "true" in /repository/conf/synapse.properties file, This
> will replace space in the json to "JsonReader_32" value. So sample would be
> as follows
>
> input Json -
> {
>  "abc nnn": "value1"
> }
>
> output XML -
> value1
>
>
> And this works other way around as well, say you need to convert XML to
> json and json element should need to have a space within it, then you can
> use "JsonReader_32" in xml to get the space in json output, for example,
>
> input xml -
> value1
>
> output json -
> {
> "abc nnn": "value1"
> }
>
> I have added this info to jira as well,
> @Praneesha, IMO better have it in docs as well.
>
> Thanks,
>
> On Thu, May 5, 2016 at 2:40 PM, Udara Liyanage  wrote:
>
>> Hi,
>>
>> i think option 1 is better, As I remember earlier ESB versions uses
>> underscore for space.
>>
>> On Thu, May 5, 2016 at 1:53 AM, Rajith Vitharana 
>> wrote:
>>
>>> Hi,
>>>
>>> So what would be the best convention to follow
>>> 1 - just throw a error saying can't convert to XML because of the space
>>> character
>>> 2 - encode that space (will need to support this when converting back to
>>> json as well)
>>>
>>> Thanks,
>>>
>>> On Tue, Mar 8, 2016 at 9:37 AM, Udara Liyanage  wrote:
>>>
 Hi,

 Yes, I also think it is a bug in json to xml conversion. I will create
 a jira for this.

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


>>>
>>>
>>> --
>>> Rajith Vitharana
>>>
>>> Software Engineer,
>>> WSO2 Inc. : wso2.com
>>> Mobile : +94715883223
>>> Blog : http://lankavitharana.blogspot.com/
>>>
>>
>>
>>
>> --
>>
>> Udara Liyanage
>> Software Engineer
>> WSO2, Inc.: http://wso2.com
>> lean. enterprise. middleware
>>
>> web: http://udaraliyanage.wordpress.com
>> phone: +94 71 443 6897
>>
>
>
>
> --
> Rajith Vitharana
>
> Software Engineer,
> WSO2 Inc. : wso2.com
> Mobile : +94715883223
> Blog : http://lankavitharana.blogspot.com/
>



-- 
Thanks & Best Regards,
*Praneesha Chandrasiri*
*Technical Writer*
*WSO2 Inc. *
*Mobile: +(94) 718156888*
*E-mail: pranee...@wso2.com *
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Xpath expression to fetch a property which has space in name

2016-05-10 Thread Rajith Vitharana
Hi All,

This can be avoided by using "synapse.commons.json.buildValidNCNames" to
value "true" in /repository/conf/synapse.properties file, This
will replace space in the json to "JsonReader_32" value. So sample would be
as follows

input Json -
{
 "abc nnn": "value1"
}

output XML -
value1


And this works other way around as well, say you need to convert XML to
json and json element should need to have a space within it, then you can
use "JsonReader_32" in xml to get the space in json output, for example,

input xml -
value1

output json -
{
"abc nnn": "value1"
}

I have added this info to jira as well,
@Praneesha, IMO better have it in docs as well.

Thanks,

On Thu, May 5, 2016 at 2:40 PM, Udara Liyanage  wrote:

> Hi,
>
> i think option 1 is better, As I remember earlier ESB versions uses
> underscore for space.
>
> On Thu, May 5, 2016 at 1:53 AM, Rajith Vitharana  wrote:
>
>> Hi,
>>
>> So what would be the best convention to follow
>> 1 - just throw a error saying can't convert to XML because of the space
>> character
>> 2 - encode that space (will need to support this when converting back to
>> json as well)
>>
>> Thanks,
>>
>> On Tue, Mar 8, 2016 at 9:37 AM, Udara Liyanage  wrote:
>>
>>> Hi,
>>>
>>> Yes, I also think it is a bug in json to xml conversion. I will create a
>>> jira for this.
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Rajith Vitharana
>>
>> Software Engineer,
>> WSO2 Inc. : wso2.com
>> Mobile : +94715883223
>> Blog : http://lankavitharana.blogspot.com/
>>
>
>
>
> --
>
> Udara Liyanage
> Software Engineer
> WSO2, Inc.: http://wso2.com
> lean. enterprise. middleware
>
> web: http://udaraliyanage.wordpress.com
> phone: +94 71 443 6897
>



-- 
Rajith Vitharana

Software Engineer,
WSO2 Inc. : wso2.com
Mobile : +94715883223
Blog : http://lankavitharana.blogspot.com/
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Xpath expression to fetch a property which has space in name

2016-03-07 Thread Udara Liyanage
Hi,

Yes, I also think it is a bug in json to xml conversion. I will create a
jira for this.
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Xpath expression to fetch a property which has space in name

2016-03-07 Thread Rasika Perera
​Hi Jonathan,

Please find the inline comments.
​


> If it were me I’d try a workaround transforming the spaces to underscores
> or something in the JSON before converting it to XML, and file some JIRAs
> on the buggy conversion algorithm.

​Agreed. totally +1.​ Probably replacing with an unusable character(rather
than underscore) will protect you from invalid translations.

Regards
~Rasika

On Tue, Mar 8, 2016 at 1:37 AM, Jonathan Marsh  wrote:

> FWIW, XML also requires attributes to have the =”” part.  Looks like we
> are using a buggy JSON-XML conversion library if it’s generating malformed
> XML.  If our XPath is working on that at all it’s also buggy.  There is no
> convention in XML itself for escaping spaces in names, it will have to be a
> convention of (a proper) conversion algorithm.
>
>
>
> If it were me I’d try a workaround transforming the spaces to underscores
> or something in the JSON before converting it to XML, and file some JIRAs
> on the buggy conversion algorithm.
>
>
>
> -Jonathan
>
>
>
> *From:* Dev [mailto:dev-boun...@wso2.org] *On Behalf Of *Rasika Perera
> *Sent:* Monday, March 07, 2016 11:34 AM
> *To:* Udara Liyanage
> *Cc:* WSO2 Developers' List
> *Subject:* Re: [Dev] Xpath expression to fetch a property which has space
> in name
>
>
>
> Hi Udara,
>
>
>
> According to the W3C XML 1.0 Specification
>  you *cannot* have spaces
> on the XML element name. To be precise;
>
>
>
> [4a]  NameChar::=NameStartChar | "-" | "." | [0-9] | #xB7 |
> [#x0300-#x036F] | [#x203F-#x2040]
>
> [5]Name::=NameStartChar (NameChar)*
>
>
>
> However; As I feel when there are XML element names with *spaces* the
> second word is treated as an *attribute* to the XML element.
>
>
>
> eg.  would be treated as; 
>
>
>
> Therefore; Can you try; "" which should do the trick.
>
>
>
> Thanks,
>
> ~Rasika
>
>
>
> On Mon, Mar 7, 2016 at 2:55 PM, Udara Liyanage  wrote:
>
> Hi,
>
>
>
> It gives me following error.
>
>
>
> Below is my synapse configs.
>
>
>
> ##call  external api
>
>   
>
> 
>
>https://api.peoplehr.net/Query"/>
>
> 
>
>  
>
>
>
> #iterate thru results
>
> 
>
> 
>
>
>
>   
>
>  
>
>   
>
>
>
> Sample API call output
>
>
>
> {
>
>
>
> "Message": "The requested processed successfully.",
>
> "Result": [
>
> {
>
> "Department": "HUMAN RESOURCES AND ADMINISTRATION",
>
> "Employee Id": "456",
>
>
>
> },
>
> {
>
> "Department": "MARKETING",
>
> "Employee Id": "123",
>
> },
>
>
>
>
>
> JsonUtil #toJsonStream. Could not create input stream from XML element
> [123 Id>ENGINEERING]. Error>>> Could not
> convert OMElement to JSON. Invalid XML payload.
>
>
>
> On Mon, Mar 7, 2016 at 2:42 PM, Keerthika Mahendralingam <
> keerth...@wso2.com> wrote:
>
> Hi Udara,
>
> Since you are getting JSON response, I think you can use json-eval to get
> the value form response like,
>
>
>
> 
>
>
>
>
>
> Thanks,
>
>
>
> On Mon, Mar 7, 2016 at 2:31 PM, Udara Liyanage  wrote:
>
> Hi,
>
>
>
> We have an call mediator which calls and external API. API response is
> json. Json properties has spaces in names.
>
> {
>
> "Department": "ENGINEERING",
>
> "Employee Id": "LK",
>
> "First Name": "Udara",
>
>
>
> }
>
>
>
> ESB converts this to xml, those xml element names also have space in
> element name.
>
>
>
> On Mon, Mar 7, 2016 at 2:05 PM, Udara Liyanage  wrote:
>
> Hi,
>
>
>
> Below is the log mediator output. Even the converted xml tag has space in
> its name.
>
>
>
> [2016-03-07 14:00:36,587]  INFO - LogMediator To:
> http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: ,
> MessageID: urn:uuid:2b6e4e6d-9180-4083-b06b-d12c08c5178e, Direction:
> request, Envelope:  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
> ">**123** Name>udaraliyanage Name>
>
>
>
> On Mon, Mar 7, 2016 at 12:06 PM, Udara Liyanage  wrote:
>
> Hi Thusitha,
>
>
>
> I already tried that, but negative.
>
>
>
> On Mon, Mar 7, 2016 at 11:59 AM, Thusitha Thilina Dayaratne <
> thusit...@wso2.com> wrote:
>
> Hi Udara,
>
>
>
> Did you tried replace the space with "_x0020_"? according to the [1] it
> seems work for spaces
>
> [1] - 
> *http://users.jackrabbit.apache.narkive.com/r9aFPfiI/xpath-query-with-space-in-node-name
> *
>
>
>
> Thanks
>
> On Mon, Mar 7, 2016 at 11:43 AM, Udara Liyanage  wrote:
>
> Hi,
>
>
>
> I am trying to fetch an property value from a json payload similar to
> below.
>
> {
>
> "Department": "ABC",
>
> "Employee Id": "123",
>
> "Work Email": "ud...@wso2.com"
>
> },
>
>
>
> I 

Re: [Dev] Xpath expression to fetch a property which has space in name

2016-03-07 Thread Jonathan Marsh
FWIW, XML also requires attributes to have the =”” part.  Looks like we are
using a buggy JSON-XML conversion library if it’s generating malformed
XML.  If our XPath is working on that at all it’s also buggy.  There is no
convention in XML itself for escaping spaces in names, it will have to be a
convention of (a proper) conversion algorithm.



If it were me I’d try a workaround transforming the spaces to underscores
or something in the JSON before converting it to XML, and file some JIRAs
on the buggy conversion algorithm.



-Jonathan



*From:* Dev [mailto:dev-boun...@wso2.org] *On Behalf Of *Rasika Perera
*Sent:* Monday, March 07, 2016 11:34 AM
*To:* Udara Liyanage
*Cc:* WSO2 Developers' List
*Subject:* Re: [Dev] Xpath expression to fetch a property which has space
in name



Hi Udara,



According to the W3C XML 1.0 Specification
 you *cannot* have spaces on
the XML element name. To be precise;



[4a]  NameChar::=NameStartChar | "-" | "." | [0-9] | #xB7 |
[#x0300-#x036F] | [#x203F-#x2040]

[5]Name::=NameStartChar (NameChar)*



However; As I feel when there are XML element names with *spaces* the
second word is treated as an *attribute* to the XML element.



eg.  would be treated as; 



Therefore; Can you try; ""
which should do the trick.



Thanks,

~Rasika



On Mon, Mar 7, 2016 at 2:55 PM, Udara Liyanage  wrote:

Hi,



It gives me following error.



Below is my synapse configs.



##call  external api

  



   https://api.peoplehr.net/Query"/>



 



#iterate thru results





   

  

 

  



Sample API call output



{



"Message": "The requested processed successfully.",

"Result": [

{

"Department": "HUMAN RESOURCES AND ADMINISTRATION",

"Employee Id": "456",



},

{

"Department": "MARKETING",

"Employee Id": "123",

},





JsonUtil #toJsonStream. Could not create input stream from XML element
[123ENGINEERING]. Error>>> Could not
convert OMElement to JSON. Invalid XML payload.



On Mon, Mar 7, 2016 at 2:42 PM, Keerthika Mahendralingam 
wrote:

Hi Udara,

Since you are getting JSON response, I think you can use json-eval to get
the value form response like,









Thanks,



On Mon, Mar 7, 2016 at 2:31 PM, Udara Liyanage  wrote:

Hi,



We have an call mediator which calls and external API. API response is
json. Json properties has spaces in names.

{

"Department": "ENGINEERING",

"Employee Id": "LK",

"First Name": "Udara",



}



ESB converts this to xml, those xml element names also have space in
element name.



On Mon, Mar 7, 2016 at 2:05 PM, Udara Liyanage  wrote:

Hi,



Below is the log mediator output. Even the converted xml tag has space in
its name.



[2016-03-07 14:00:36,587]  INFO - LogMediator To:
http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: ,
MessageID: urn:uuid:2b6e4e6d-9180-4083-b06b-d12c08c5178e, Direction:
request, Envelope: http://schemas.xmlsoap.org/soap/envelope/
">**123**udaraliyanage



On Mon, Mar 7, 2016 at 12:06 PM, Udara Liyanage  wrote:

Hi Thusitha,



I already tried that, but negative.



On Mon, Mar 7, 2016 at 11:59 AM, Thusitha Thilina Dayaratne <
thusit...@wso2.com> wrote:

Hi Udara,



Did you tried replace the space with "_x0020_"? according to the [1] it
seems work for spaces

[1] - 
*http://users.jackrabbit.apache.narkive.com/r9aFPfiI/xpath-query-with-space-in-node-name
*



Thanks

On Mon, Mar 7, 2016 at 11:43 AM, Udara Liyanage  wrote:

Hi,



I am trying to fetch an property value from a json payload similar to below.

{

"Department": "ABC",

"Employee Id": "123",

"Work Email": "ud...@wso2.com"

},



I could extract Department value by below xpath expression.







However when I found difficulties when the property name contains an space
in middle. I tried few options which were not successful.  What is the
correct way to escape space character.










-- 


Udara Liyanage

Software Engineer

WSO2, Inc.: http://wso2.com

lean. enterprise. middleware

web: http://udaraliyanage.wordpress.com

phone: +94 71 443 6897



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





-- 

Thusitha Dayaratne

Software Engineer

WSO2 Inc. - lean . enterprise . middleware |  wso2.com



Mobile  +94712756809

Blog  alokayasoya.blogspot.com

Abouthttp://about.me/thusithathilina







-- 


Udara Liyanage

Software Engineer

WSO2, Inc.: http://wso2.com

lean. enterprise. middleware

web: 

Re: [Dev] Xpath expression to fetch a property which has space in name

2016-03-07 Thread Rasika Perera
Hi Udara,

According to the W3C XML 1.0 Specification
 you *cannot* have spaces on
the XML element name. To be precise;

[4a]  NameChar::=NameStartChar | "-" | "." | [0-9] | #xB7 |
[#x0300-#x036F] | [#x203F-#x2040]
[5]Name::=NameStartChar (NameChar)*

However; As I feel when there are XML element names with *spaces* the
second word is treated as an *attribute* to the XML element.

eg.  would be treated as; 

Therefore; Can you try; ""
which should do the trick.

Thanks,
~Rasika

On Mon, Mar 7, 2016 at 2:55 PM, Udara Liyanage  wrote:

> Hi,
>
> It gives me following error.
>
> Below is my synapse configs.
>
> ##call  external api
>   
> 
>https://api.peoplehr.net/Query"/>
> 
>  
>
> #iterate thru results
> 
> 
>
>   
>  
>   
>
> Sample API call output
>
> {
>
>
> "Message": "The requested processed successfully.",
> "Result": [
> {
> "Department": "HUMAN RESOURCES AND ADMINISTRATION",
> "Employee Id": "456",
>
> },
> {
> "Department": "MARKETING",
> "Employee Id": "123",
> },
>
>
> JsonUtil #toJsonStream. Could not create input stream from XML element
> [123 Id>ENGINEERING]. Error>>> Could not
> convert OMElement to JSON. Invalid XML payload.
>
> On Mon, Mar 7, 2016 at 2:42 PM, Keerthika Mahendralingam <
> keerth...@wso2.com> wrote:
>
>> Hi Udara,
>> Since you are getting JSON response, I think you can use json-eval to get
>> the value form response like,
>>
>> 
>>
>>
>> Thanks,
>>
>> On Mon, Mar 7, 2016 at 2:31 PM, Udara Liyanage  wrote:
>>
>>> Hi,
>>>
>>> We have an call mediator which calls and external API. API response is
>>> json. Json properties has spaces in names.
>>> {
>>> "Department": "ENGINEERING",
>>> "Employee Id": "LK",
>>> "First Name": "Udara",
>>>
>>> }
>>>
>>> ESB converts this to xml, those xml element names also have space in
>>> element name.
>>>
>>> On Mon, Mar 7, 2016 at 2:05 PM, Udara Liyanage  wrote:
>>>
 Hi,

 Below is the log mediator output. Even the converted xml tag has space
 in its name.

 [2016-03-07 14:00:36,587]  INFO - LogMediator To:
 http://www.w3.org/2005/08/addressing/anonymous, WSAction: ,
 SOAPAction: , MessageID: urn:uuid:2b6e4e6d-9180-4083-b06b-d12c08c5178e,
 Direction: request, Envelope: >>> encoding='utf-8'?>http://schemas.xmlsoap.org/soap/envelope/;>*>>> Id>*123**udara>>> Name>liyanage

 On Mon, Mar 7, 2016 at 12:06 PM, Udara Liyanage  wrote:

> Hi Thusitha,
>
> I already tried that, but negative.
>
> On Mon, Mar 7, 2016 at 11:59 AM, Thusitha Thilina Dayaratne <
> thusit...@wso2.com> wrote:
>
>> Hi Udara,
>>
>> Did you tried replace the space with "_x0020_"? according to the [1]
>> it seems work for spaces
>> [1] - 
>> *http://users.jackrabbit.apache.narkive.com/r9aFPfiI/xpath-query-with-space-in-node-name
>> *
>>
>> Thanks
>> On Mon, Mar 7, 2016 at 11:43 AM, Udara Liyanage 
>> wrote:
>>
>>> Hi,
>>>
>>> I am trying to fetch an property value from a json payload similar
>>> to below.
>>> {
>>> "Department": "ABC",
>>> "Employee Id": "123",
>>> "Work Email": "ud...@wso2.com"
>>> },
>>>
>>> I could extract Department value by below xpath expression.
>>>
>>> 
>>>
>>> However when I found difficulties when the property name contains an
>>> space in middle. I tried few options which were not successful.  What is
>>> the correct way to escape space character.
>>>
>>> 
>>>
>>> 
>>>
>>> --
>>>
>>> Udara Liyanage
>>> Software Engineer
>>> WSO2, Inc.: http://wso2.com
>>> lean. enterprise. middleware
>>>
>>> web: http://udaraliyanage.wordpress.com
>>> phone: +94 71 443 6897
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Thusitha Dayaratne
>> Software Engineer
>> WSO2 Inc. - lean . enterprise . middleware |  wso2.com
>>
>> Mobile  +94712756809
>> Blog  alokayasoya.blogspot.com
>> Abouthttp://about.me/thusithathilina
>>
>>
>
>
> --
>
> Udara Liyanage
> Software Engineer
> WSO2, Inc.: http://wso2.com
> lean. enterprise. middleware
>
> web: http://udaraliyanage.wordpress.com
> phone: +94 71 443 6897
>



 --

 Udara Liyanage
 

Re: [Dev] Xpath expression to fetch a property which has space in name

2016-03-07 Thread Udara Liyanage
Hi,

It gives me following error.

Below is my synapse configs.

##call  external api
  

   https://api.peoplehr.net/Query"/>

 

#iterate thru results


   
  
 
  

Sample API call output

{


"Message": "The requested processed successfully.",
"Result": [
{
"Department": "HUMAN RESOURCES AND ADMINISTRATION",
"Employee Id": "456",

},
{
"Department": "MARKETING",
"Employee Id": "123",
},


JsonUtil #toJsonStream. Could not create input stream from XML element
[123ENGINEERING]. Error>>> Could not
convert OMElement to JSON. Invalid XML payload.

On Mon, Mar 7, 2016 at 2:42 PM, Keerthika Mahendralingam  wrote:

> Hi Udara,
> Since you are getting JSON response, I think you can use json-eval to get
> the value form response like,
>
> 
>
>
> Thanks,
>
> On Mon, Mar 7, 2016 at 2:31 PM, Udara Liyanage  wrote:
>
>> Hi,
>>
>> We have an call mediator which calls and external API. API response is
>> json. Json properties has spaces in names.
>> {
>> "Department": "ENGINEERING",
>> "Employee Id": "LK",
>> "First Name": "Udara",
>>
>> }
>>
>> ESB converts this to xml, those xml element names also have space in
>> element name.
>>
>> On Mon, Mar 7, 2016 at 2:05 PM, Udara Liyanage  wrote:
>>
>>> Hi,
>>>
>>> Below is the log mediator output. Even the converted xml tag has space
>>> in its name.
>>>
>>> [2016-03-07 14:00:36,587]  INFO - LogMediator To:
>>> http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction:
>>> , MessageID: urn:uuid:2b6e4e6d-9180-4083-b06b-d12c08c5178e, Direction:
>>> request, Envelope: >> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
>>> ">**123**>> Name>udaraliyanage>> Name>
>>>
>>> On Mon, Mar 7, 2016 at 12:06 PM, Udara Liyanage  wrote:
>>>
 Hi Thusitha,

 I already tried that, but negative.

 On Mon, Mar 7, 2016 at 11:59 AM, Thusitha Thilina Dayaratne <
 thusit...@wso2.com> wrote:

> Hi Udara,
>
> Did you tried replace the space with "_x0020_"? according to the [1]
> it seems work for spaces
> [1] - 
> *http://users.jackrabbit.apache.narkive.com/r9aFPfiI/xpath-query-with-space-in-node-name
> *
>
> Thanks
> On Mon, Mar 7, 2016 at 11:43 AM, Udara Liyanage 
> wrote:
>
>> Hi,
>>
>> I am trying to fetch an property value from a json payload similar to
>> below.
>> {
>> "Department": "ABC",
>> "Employee Id": "123",
>> "Work Email": "ud...@wso2.com"
>> },
>>
>> I could extract Department value by below xpath expression.
>>
>> 
>>
>> However when I found difficulties when the property name contains an
>> space in middle. I tried few options which were not successful.  What is
>> the correct way to escape space character.
>>
>> 
>>
>> 
>>
>> --
>>
>> Udara Liyanage
>> Software Engineer
>> WSO2, Inc.: http://wso2.com
>> lean. enterprise. middleware
>>
>> web: http://udaraliyanage.wordpress.com
>> phone: +94 71 443 6897
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Thusitha Dayaratne
> Software Engineer
> WSO2 Inc. - lean . enterprise . middleware |  wso2.com
>
> Mobile  +94712756809
> Blog  alokayasoya.blogspot.com
> Abouthttp://about.me/thusithathilina
>
>


 --

 Udara Liyanage
 Software Engineer
 WSO2, Inc.: http://wso2.com
 lean. enterprise. middleware

 web: http://udaraliyanage.wordpress.com
 phone: +94 71 443 6897

>>>
>>>
>>>
>>> --
>>>
>>> Udara Liyanage
>>> Software Engineer
>>> WSO2, Inc.: http://wso2.com
>>> lean. enterprise. middleware
>>>
>>> web: http://udaraliyanage.wordpress.com
>>> phone: +94 71 443 6897
>>>
>>
>>
>>
>> --
>>
>> Udara Liyanage
>> Software Engineer
>> WSO2, Inc.: http://wso2.com
>> lean. enterprise. middleware
>>
>> web: http://udaraliyanage.wordpress.com
>> phone: +94 71 443 6897
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> 
> Keerthika Mahendralingam
> Associate Software Engineer
> Mobile :+94 (0) 776 121144
> keerth...@wso2.com
> WSO2, Inc.
> lean . enterprise . middleware
>



-- 

Udara Liyanage
Software Engineer
WSO2, Inc.: http://wso2.com
lean. enterprise. middleware

web: http://udaraliyanage.wordpress.com
phone: 

Re: [Dev] Xpath expression to fetch a property which has space in name

2016-03-07 Thread Keerthika Mahendralingam
Hi Udara,
Since you are getting JSON response, I think you can use json-eval to get
the value form response like,




Thanks,

On Mon, Mar 7, 2016 at 2:31 PM, Udara Liyanage  wrote:

> Hi,
>
> We have an call mediator which calls and external API. API response is
> json. Json properties has spaces in names.
> {
> "Department": "ENGINEERING",
> "Employee Id": "LK",
> "First Name": "Udara",
>
> }
>
> ESB converts this to xml, those xml element names also have space in
> element name.
>
> On Mon, Mar 7, 2016 at 2:05 PM, Udara Liyanage  wrote:
>
>> Hi,
>>
>> Below is the log mediator output. Even the converted xml tag has space in
>> its name.
>>
>> [2016-03-07 14:00:36,587]  INFO - LogMediator To:
>> http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction:
>> , MessageID: urn:uuid:2b6e4e6d-9180-4083-b06b-d12c08c5178e, Direction:
>> request, Envelope: > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
>> ">**123**> Name>udaraliyanage> Name>
>>
>> On Mon, Mar 7, 2016 at 12:06 PM, Udara Liyanage  wrote:
>>
>>> Hi Thusitha,
>>>
>>> I already tried that, but negative.
>>>
>>> On Mon, Mar 7, 2016 at 11:59 AM, Thusitha Thilina Dayaratne <
>>> thusit...@wso2.com> wrote:
>>>
 Hi Udara,

 Did you tried replace the space with "_x0020_"? according to the [1]
 it seems work for spaces
 [1] - 
 *http://users.jackrabbit.apache.narkive.com/r9aFPfiI/xpath-query-with-space-in-node-name
 *

 Thanks
 On Mon, Mar 7, 2016 at 11:43 AM, Udara Liyanage  wrote:

> Hi,
>
> I am trying to fetch an property value from a json payload similar to
> below.
> {
> "Department": "ABC",
> "Employee Id": "123",
> "Work Email": "ud...@wso2.com"
> },
>
> I could extract Department value by below xpath expression.
>
> 
>
> However when I found difficulties when the property name contains an
> space in middle. I tried few options which were not successful.  What is
> the correct way to escape space character.
>
> 
>
> 
>
> --
>
> Udara Liyanage
> Software Engineer
> WSO2, Inc.: http://wso2.com
> lean. enterprise. middleware
>
> web: http://udaraliyanage.wordpress.com
> phone: +94 71 443 6897
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


 --
 Thusitha Dayaratne
 Software Engineer
 WSO2 Inc. - lean . enterprise . middleware |  wso2.com

 Mobile  +94712756809
 Blog  alokayasoya.blogspot.com
 Abouthttp://about.me/thusithathilina


>>>
>>>
>>> --
>>>
>>> Udara Liyanage
>>> Software Engineer
>>> WSO2, Inc.: http://wso2.com
>>> lean. enterprise. middleware
>>>
>>> web: http://udaraliyanage.wordpress.com
>>> phone: +94 71 443 6897
>>>
>>
>>
>>
>> --
>>
>> Udara Liyanage
>> Software Engineer
>> WSO2, Inc.: http://wso2.com
>> lean. enterprise. middleware
>>
>> web: http://udaraliyanage.wordpress.com
>> phone: +94 71 443 6897
>>
>
>
>
> --
>
> Udara Liyanage
> Software Engineer
> WSO2, Inc.: http://wso2.com
> lean. enterprise. middleware
>
> web: http://udaraliyanage.wordpress.com
> phone: +94 71 443 6897
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 

Keerthika Mahendralingam
Associate Software Engineer
Mobile :+94 (0) 776 121144
keerth...@wso2.com
WSO2, Inc.
lean . enterprise . middleware
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Xpath expression to fetch a property which has space in name

2016-03-07 Thread Udara Liyanage
Hi,

We have an call mediator which calls and external API. API response is
json. Json properties has spaces in names.
{
"Department": "ENGINEERING",
"Employee Id": "LK",
"First Name": "Udara",

}

ESB converts this to xml, those xml element names also have space in
element name.

On Mon, Mar 7, 2016 at 2:05 PM, Udara Liyanage  wrote:

> Hi,
>
> Below is the log mediator output. Even the converted xml tag has space in
> its name.
>
> [2016-03-07 14:00:36,587]  INFO - LogMediator To:
> http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: ,
> MessageID: urn:uuid:2b6e4e6d-9180-4083-b06b-d12c08c5178e, Direction:
> request, Envelope:  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
> ">**123** Name>udaraliyanage Name>
>
> On Mon, Mar 7, 2016 at 12:06 PM, Udara Liyanage  wrote:
>
>> Hi Thusitha,
>>
>> I already tried that, but negative.
>>
>> On Mon, Mar 7, 2016 at 11:59 AM, Thusitha Thilina Dayaratne <
>> thusit...@wso2.com> wrote:
>>
>>> Hi Udara,
>>>
>>> Did you tried replace the space with "_x0020_"? according to the [1] it
>>> seems work for spaces
>>> [1] - 
>>> *http://users.jackrabbit.apache.narkive.com/r9aFPfiI/xpath-query-with-space-in-node-name
>>> *
>>>
>>> Thanks
>>> On Mon, Mar 7, 2016 at 11:43 AM, Udara Liyanage  wrote:
>>>
 Hi,

 I am trying to fetch an property value from a json payload similar to
 below.
 {
 "Department": "ABC",
 "Employee Id": "123",
 "Work Email": "ud...@wso2.com"
 },

 I could extract Department value by below xpath expression.

 

 However when I found difficulties when the property name contains an
 space in middle. I tried few options which were not successful.  What is
 the correct way to escape space character.

 

 

 --

 Udara Liyanage
 Software Engineer
 WSO2, Inc.: http://wso2.com
 lean. enterprise. middleware

 web: http://udaraliyanage.wordpress.com
 phone: +94 71 443 6897

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


>>>
>>>
>>> --
>>> Thusitha Dayaratne
>>> Software Engineer
>>> WSO2 Inc. - lean . enterprise . middleware |  wso2.com
>>>
>>> Mobile  +94712756809
>>> Blog  alokayasoya.blogspot.com
>>> Abouthttp://about.me/thusithathilina
>>>
>>>
>>
>>
>> --
>>
>> Udara Liyanage
>> Software Engineer
>> WSO2, Inc.: http://wso2.com
>> lean. enterprise. middleware
>>
>> web: http://udaraliyanage.wordpress.com
>> phone: +94 71 443 6897
>>
>
>
>
> --
>
> Udara Liyanage
> Software Engineer
> WSO2, Inc.: http://wso2.com
> lean. enterprise. middleware
>
> web: http://udaraliyanage.wordpress.com
> phone: +94 71 443 6897
>



-- 

Udara Liyanage
Software Engineer
WSO2, Inc.: http://wso2.com
lean. enterprise. middleware

web: http://udaraliyanage.wordpress.com
phone: +94 71 443 6897
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Xpath expression to fetch a property which has space in name

2016-03-07 Thread Udara Liyanage
Hi,

Below is the log mediator output. Even the converted xml tag has space in
its name.

[2016-03-07 14:00:36,587]  INFO - LogMediator To:
http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: ,
MessageID: urn:uuid:2b6e4e6d-9180-4083-b06b-d12c08c5178e, Direction:
request, Envelope: http://schemas.xmlsoap.org/soap/envelope/
">**123**udaraliyanage

On Mon, Mar 7, 2016 at 12:06 PM, Udara Liyanage  wrote:

> Hi Thusitha,
>
> I already tried that, but negative.
>
> On Mon, Mar 7, 2016 at 11:59 AM, Thusitha Thilina Dayaratne <
> thusit...@wso2.com> wrote:
>
>> Hi Udara,
>>
>> Did you tried replace the space with "_x0020_"? according to the [1] it
>> seems work for spaces
>> [1] - 
>> *http://users.jackrabbit.apache.narkive.com/r9aFPfiI/xpath-query-with-space-in-node-name
>> *
>>
>> Thanks
>> On Mon, Mar 7, 2016 at 11:43 AM, Udara Liyanage  wrote:
>>
>>> Hi,
>>>
>>> I am trying to fetch an property value from a json payload similar to
>>> below.
>>> {
>>> "Department": "ABC",
>>> "Employee Id": "123",
>>> "Work Email": "ud...@wso2.com"
>>> },
>>>
>>> I could extract Department value by below xpath expression.
>>>
>>> 
>>>
>>> However when I found difficulties when the property name contains an
>>> space in middle. I tried few options which were not successful.  What is
>>> the correct way to escape space character.
>>>
>>> 
>>>
>>> 
>>>
>>> --
>>>
>>> Udara Liyanage
>>> Software Engineer
>>> WSO2, Inc.: http://wso2.com
>>> lean. enterprise. middleware
>>>
>>> web: http://udaraliyanage.wordpress.com
>>> phone: +94 71 443 6897
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Thusitha Dayaratne
>> Software Engineer
>> WSO2 Inc. - lean . enterprise . middleware |  wso2.com
>>
>> Mobile  +94712756809
>> Blog  alokayasoya.blogspot.com
>> Abouthttp://about.me/thusithathilina
>>
>>
>
>
> --
>
> Udara Liyanage
> Software Engineer
> WSO2, Inc.: http://wso2.com
> lean. enterprise. middleware
>
> web: http://udaraliyanage.wordpress.com
> phone: +94 71 443 6897
>



-- 

Udara Liyanage
Software Engineer
WSO2, Inc.: http://wso2.com
lean. enterprise. middleware

web: http://udaraliyanage.wordpress.com
phone: +94 71 443 6897
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Xpath expression to fetch a property which has space in name

2016-03-06 Thread Udara Liyanage
Hi Thusitha,

I already tried that, but negative.

On Mon, Mar 7, 2016 at 11:59 AM, Thusitha Thilina Dayaratne <
thusit...@wso2.com> wrote:

> Hi Udara,
>
> Did you tried replace the space with "_x0020_"? according to the [1] it
> seems work for spaces
> [1] - 
> *http://users.jackrabbit.apache.narkive.com/r9aFPfiI/xpath-query-with-space-in-node-name
> *
>
> Thanks
> On Mon, Mar 7, 2016 at 11:43 AM, Udara Liyanage  wrote:
>
>> Hi,
>>
>> I am trying to fetch an property value from a json payload similar to
>> below.
>> {
>> "Department": "ABC",
>> "Employee Id": "123",
>> "Work Email": "ud...@wso2.com"
>> },
>>
>> I could extract Department value by below xpath expression.
>>
>> 
>>
>> However when I found difficulties when the property name contains an
>> space in middle. I tried few options which were not successful.  What is
>> the correct way to escape space character.
>>
>> 
>>
>> 
>>
>> --
>>
>> Udara Liyanage
>> Software Engineer
>> WSO2, Inc.: http://wso2.com
>> lean. enterprise. middleware
>>
>> web: http://udaraliyanage.wordpress.com
>> phone: +94 71 443 6897
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Thusitha Dayaratne
> Software Engineer
> WSO2 Inc. - lean . enterprise . middleware |  wso2.com
>
> Mobile  +94712756809
> Blog  alokayasoya.blogspot.com
> Abouthttp://about.me/thusithathilina
>
>


-- 

Udara Liyanage
Software Engineer
WSO2, Inc.: http://wso2.com
lean. enterprise. middleware

web: http://udaraliyanage.wordpress.com
phone: +94 71 443 6897
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Xpath expression to fetch a property which has space in name

2016-03-06 Thread Thusitha Thilina Dayaratne
Hi Udara,

Did you tried replace the space with "_x0020_"? according to the [1] it
seems work for spaces
[1] - 
*http://users.jackrabbit.apache.narkive.com/r9aFPfiI/xpath-query-with-space-in-node-name
*

Thanks
On Mon, Mar 7, 2016 at 11:43 AM, Udara Liyanage  wrote:

> Hi,
>
> I am trying to fetch an property value from a json payload similar to
> below.
> {
> "Department": "ABC",
> "Employee Id": "123",
> "Work Email": "ud...@wso2.com"
> },
>
> I could extract Department value by below xpath expression.
>
> 
>
> However when I found difficulties when the property name contains an space
> in middle. I tried few options which were not successful.  What is the
> correct way to escape space character.
>
> 
>
> 
>
> --
>
> Udara Liyanage
> Software Engineer
> WSO2, Inc.: http://wso2.com
> lean. enterprise. middleware
>
> web: http://udaraliyanage.wordpress.com
> phone: +94 71 443 6897
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Xpath expression to fetch a property which has space in name

2016-03-06 Thread Udara Liyanage
Hi,

I am trying to fetch an property value from a json payload similar to below.
{
"Department": "ABC",
"Employee Id": "123",
"Work Email": "ud...@wso2.com"
},

I could extract Department value by below xpath expression.



However when I found difficulties when the property name contains an space
in middle. I tried few options which were not successful.  What is the
correct way to escape space character.





-- 

Udara Liyanage
Software Engineer
WSO2, Inc.: http://wso2.com
lean. enterprise. middleware

web: http://udaraliyanage.wordpress.com
phone: +94 71 443 6897
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev