On 2006-05-18, at 19:20 EDT, J Crowley wrote:

> Okay.  I'll give you a rough example:
>
> So, say you have an XML file datafile.xml with the following data:
>
> <mydata>
>     <item>Herring</item>
>     <item>Ski-ball</item>
>     <item>Hornet leg</item>
>     <item>Pie</item>
>     <item>Femur of Michael Madsen</item>
> </mydata>
>
> In the Laszlo app, you could do:
>
> <dataset name="randomThings" src="datafile.xml" type="http"  
> request="true"/>
> <datapointer name="randomDP" xpath="randomThings:/mydata" />
>
> <method event="oninit">
>     var size = randomDP.getNodeCount();
>     for(var i = 1; i <= size; i++){
>         randomDP.setXPath('randomThings:/mydata[1]/item[' + i + ']');
>         randomDP.setNodeAttribute('num', i);
>     }
> </method>
>
> And then to reference (for instance):
>
> randomDP.setXPath('randomThings:/mydata[1]/item[3]');
> var position = randomDP.xpathQuery('@num');

What would randomDP.xpathQuery('position()') return?

_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user

Reply via email to