You are viewing a plain text version of this content. The canonical link for it is here.
Posted to photark-dev@incubator.apache.org by Subash Chaturanga <su...@gmail.com> on 2011/08/12 16:05:33 UTC

Re: Problem in using org.apache.tuscany.sca.data.collection.Entry in my service callback method.

On Tue, Jul 26, 2011 at 9:27 AM, Luciano Resende <lu...@gmail.com>wrote:

> On Mon, Jul 25, 2011 at 10:49 AM, Subash Chaturanga <su...@gmail.com>
> wrote:
> > Hi all,
> > I am using the org.apache.tuscany.sca.data.collection.Entry as the return
> > type of one my service methods. I am having problems in using them in the
> > callback method
> > The return type of the calling method is Entry<String, String>[] .
> >
> > So here is my callback method.
> >
> > function facebook_ff_callback(items, exception) {
> >    if(exception) {
> >   alert("Err");
> >    } else {
> >    alert(items[0].getData());
> >    }
> > }
> >
> > And I am getting no response. Is this the correct way to iterate
> > through Entry<String, String>[]  ?
> >
>
> Here are some examples on how to iterate trough a Tuscany collection in JS
>
>
> https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/samples/applications/store/src/main/resources/uiservices/store.html


Hi Luciano, I looked in to this example code. This is what i captured. What
I am returning is a Entry<String,String> which has key value pairs. I am not
getting what is "entries[i].getElementsByTagName("content")[0]" and ".....
.firstChild.nodeValue" ???

var entries = feed.getElementsByTagName("entry");
			var list = "";
			for (var i=0; i<entries.length; i++) {
				var content = entries[i].getElementsByTagName("content")[0];
				var name = content.getElementsByTagName("name")[0].firstChild.nodeValue;
				var price = content.getElementsByTagName("price")[0].firstChild.nodeValue;
				list += name + ' - ' + price + ' <br>';
			}



>
>
>
>
> --
> Luciano Resende
> http://people.apache.org/~lresende
> http://twitter.com/lresende1975
> http://lresende.blogspot.com/
>


Thanks
-- 
Subash Chaturanga
Department of Computer Science & Engineering
University of Moratuwa
Sri Lanka

Blog -  http://subashsdm.blogspot.com/
Twitter - http://twitter.com/subash89

Re: Problem in using org.apache.tuscany.sca.data.collection.Entry in my service callback method.

Posted by Subash Chaturanga <su...@gmail.com>.
Got it :-)

Those key value pairs can be easily accessible by entries[i].key and
entries[i].data.

On Fri, Aug 12, 2011 at 9:35 PM, Subash Chaturanga <su...@gmail.com>wrote:

>
>
> On Tue, Jul 26, 2011 at 9:27 AM, Luciano Resende <lu...@gmail.com>wrote:
>
>> On Mon, Jul 25, 2011 at 10:49 AM, Subash Chaturanga <su...@gmail.com>
>> wrote:
>> > Hi all,
>> > I am using the org.apache.tuscany.sca.data.collection.Entry as the
>> return
>> > type of one my service methods. I am having problems in using them in
>> the
>> > callback method
>> > The return type of the calling method is Entry<String, String>[] .
>> >
>> > So here is my callback method.
>> >
>> > function facebook_ff_callback(items, exception) {
>> >    if(exception) {
>> >   alert("Err");
>> >    } else {
>> >    alert(items[0].getData());
>> >    }
>> > }
>> >
>> > And I am getting no response. Is this the correct way to iterate
>> > through Entry<String, String>[]  ?
>> >
>>
>> Here are some examples on how to iterate trough a Tuscany collection in JS
>>
>>
>> https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/samples/applications/store/src/main/resources/uiservices/store.html
>
>
> Hi Luciano, I looked in to this example code. This is what i captured. What
> I am returning is a Entry<String,String> which has key value pairs. I am not
> getting what is "entries[i].getElementsByTagName("content")[0]" and ".....
> .firstChild.nodeValue" ???
>
> var entries = feed.getElementsByTagName("entry");
> 			var list = "";
> 			for (var i=0; i<entries.length; i++) {
> 				var content = entries[i].getElementsByTagName("content")[0];
> 				var name = content.getElementsByTagName("name")[0].firstChild.nodeValue;
> 				var price = content.getElementsByTagName("price")[0].firstChild.nodeValue;
> 				list += name + ' - ' + price + ' <br>';
> 			}
>
>
>
>>
>>
>>
>>
>> --
>>
>> Luciano Resende
>> http://people.apache.org/~lresende
>> http://twitter.com/lresende1975
>> http://lresende.blogspot.com/
>>
>
>
> Thanks
> --
> Subash Chaturanga
> Department of Computer Science & Engineering
> University of Moratuwa
> Sri Lanka
>
> Blog -  http://subashsdm.blogspot.com/
> Twitter - http://twitter.com/subash89
>
>
>


-- 
Subash Chaturanga
Department of Computer Science & Engineering
University of Moratuwa
Sri Lanka

Blog -  http://subashsdm.blogspot.com/
Twitter - http://twitter.com/subash89