Hi All:
So I'm perplexed by the behavior I'm getting. I
would think the way I'm handling the remote and locally defined
datasets would be the same.
In the sample code below, I try
to iterate through values and I"m surprised the the local dataset works
and the remote one doesn't, but at the code at the end, I'm able to
list out the contents as I expected.
==========================================
<canvas>
<!-- remote dataset looks just like local_dataset -->
<dataset name="dset" src="http:/m2/music_list" request="true"/>
<dataset name="local_dataset">
<songs>
<song>
<title>First Local</title>
<cd>First Local cd</cd>
<artist>First Local artist</artist>
</song>
<song>
<title>Second Local</title>
<cd>Second Local cd</cd>
<artist>Second Local artist</artist>
</song>
<song>
<title>Last Local</title>
<cd>Last Local cd</cd>
<artist>Last Local artist</artist>
</song>
</songs>
</dataset>
<datapointer name="local_dataset_ptr" xpath="local_dataset:/"/>
<script>
local_dataset_ptr.selectChild(2);
</script>
<text name="current_local_dataset" resize="true">Unloaded Local</text>
<button>next
<!-- this method WORKS, and cycles through the dataset -->
<method event="onclick">
current_local_dataset.setText(
local_dataset_ptr.xpathQuery( "title/text()") + " : " +
local_dataset_ptr.xpathQuery( "cd/text()") + " : " +
local_dataset_ptr.xpathQuery( "artist/text()"));
local_dataset_ptr.selectNext();
</method>
</button>
<datapointer name="remote_dataset_ptr" xpath="dset:/"/>
<script>
remote_dataset_ptr.selectChild(2);
</script>
<text name="current_remote_dataset" resize="true">Unloaded Remote</text>
<button>next
<!-- DOESN'T WORK! This Method Sets The Text To Blank -->
<method event="onclick">
current_remote_dataset.setText( remote_dataset_ptr.xpathQuery(
"title/text()"));
remote_dataset_ptr.selectNext();
</method>
</button>
<!-- But this works on the remote dataset -->
<view datapath="dset:/songs/song">
<simplelayout axis="x"/>
<text datapath="title/text()"/>
<text datapath="cd/text()"/>
<text datapath="artist/text()"/>
</view>
<text>Done!</text>
<simplelayout axis="y"/>
</canvas>