[CODE4LIB] valueforkey in javascript

2010-03-27 Thread Eric Lease Morgan
Does anybody here know how to use the valueForKey method (or some other method) 
in Javascript, specifically for the iPhone and iPod Touch?

I have successfully defined a datasource (an XML stream). Here is an XML 
snippet:

  waters
water
  name water_id='79'Agean Sea at Kos, Greece/name
/water
water
  name water_id='37''Amazon River, Peru/name
/water
water
  name water_id='100'Atlantic Ocean/name
/water
  /waters

I am able to successfully extract the values for each water's name, like this:

  function coolHandler(event)
  {
var d = dashcode.getDataSource(list);
var n = d.selection().valueForKey(name);
alert( n );
  }

The result of this handler is an echoing of the value for the name element.

Unfortunately, I want to get the value for the water_id attribute, but I can't 
for the life of me figure out how to access it.

-- 
Eric Lease Morgan


Re: [CODE4LIB] PHP bashing (was: newbie)

2010-03-27 Thread Simon Spero
On Fri, Mar 26, 2010 at 1:38 PM, William C Kurt wk...@unr.edu wrote:

 Lisp and Gaffer's tape are superior to all: elegant, clean, powerful, and
 in practice used by very few


The crew of Apollo 13 were saved using duct tape; the Deep Space 1 probe was
driven by lisp.   Inanimate Carbon Rods for all.


Re: [CODE4LIB] valueforkey in javascript

2010-03-27 Thread Francis Kayiwa

On 3/27/10 6:05 PM, Eric Lease Morgan wrote:

Does anybody here know how to use the valueForKey method (or some other method) 
in Javascript, specifically for the iPhone and iPod Touch?

I have successfully defined a datasource (an XML stream). Here is an XML 
snippet:

   waters
 water
   name water_id='79'Agean Sea at Kos, Greece/name
 /water
 water
   name water_id='37''Amazon River, Peru/name
 /water
 water
   name water_id='100'Atlantic Ocean/name
 /water
   /waters

I am able to successfully extract the values for each water's name, like this:

   function coolHandler(event)
   {
 var d = dashcode.getDataSource(list);
 var n = d.selection().valueForKey(name);
 alert( n );
   }

The result of this handler is an echoing of the value for the name element.

Unfortunately, I want to get the value for the water_id attribute, but I can't 
for the life of me figure out how to access it.



I confess I am not the JavaScript expert, but I suspect the reason 
you're having difficulty is because an element attribute is usually 
considered a child of the element.  Were I to hazard a guess, you'd need 
to look at something like:


function coolHandler(event)
{
  var d = dashcode.getDataSource(list);
  var n = d.selection().valueForKey(name.water_id);
alert( n );
}






--
The Ranger isn't gonna like it, Yogi.