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');

position should equal 3.


-Josh

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

Reply via email to