kentyler
05-02-2003, 05:17 PM
for my own reasons, i'm trying to convert a dataset into something like a recordset object in javascript
I'm using xml that you can see at
http://www.seedwiki.com/test/xmlquery.cfm?querystring=select%20*%20from%20terri tories
I can loop over the rows all right, but inside each row element there are 2 column elements, and for the life of me I can figure out how to loop over them inside the row loop.
<canvas debug = "true">
<script>
//COLUMN
function column()
{
this.name = "";
this.value = "";}
//ROW
function row()
{
this.columns = new array();
}
//RECORDSET
function recordset()
{
this.pointer = 0;
this.rows = new array();
}
</script>
<dataset autorequest="true" type="http" name="queryinfo"
src="http://www.seedwiki.com/test/xmlquery.cfm?querystring=select%20*%20from%20terri tories" />
<view>
<datapointer xpath="queryinfo:/queryinfo/data" ondata="processData()">
<method name="processData">
<![CDATA[
var myrecordset = new recordset();
counter = 0;
this.selectChild( 1 );
var numberOfFields = this.getNodeCount();
do {
for ( i = 1; i <= numberOfFields; i++ )
{
debug.write("node is " + i + " name is " + this.getXpath("column[i]/@name") );
}
} while ( this.selectNext() );
debug.write( "there are " + myrecordset.rows.length + " rows");
]]>
</method>
</datapointer>
</view>
I want to pick up the two attriubutes of each column element, its name and value.
I'm using xml that you can see at
http://www.seedwiki.com/test/xmlquery.cfm?querystring=select%20*%20from%20terri tories
I can loop over the rows all right, but inside each row element there are 2 column elements, and for the life of me I can figure out how to loop over them inside the row loop.
<canvas debug = "true">
<script>
//COLUMN
function column()
{
this.name = "";
this.value = "";}
//ROW
function row()
{
this.columns = new array();
}
//RECORDSET
function recordset()
{
this.pointer = 0;
this.rows = new array();
}
</script>
<dataset autorequest="true" type="http" name="queryinfo"
src="http://www.seedwiki.com/test/xmlquery.cfm?querystring=select%20*%20from%20terri tories" />
<view>
<datapointer xpath="queryinfo:/queryinfo/data" ondata="processData()">
<method name="processData">
<![CDATA[
var myrecordset = new recordset();
counter = 0;
this.selectChild( 1 );
var numberOfFields = this.getNodeCount();
do {
for ( i = 1; i <= numberOfFields; i++ )
{
debug.write("node is " + i + " name is " + this.getXpath("column[i]/@name") );
}
} while ( this.selectNext() );
debug.write( "there are " + myrecordset.rows.length + " rows");
]]>
</method>
</datapointer>
</view>
I want to pick up the two attriubutes of each column element, its name and value.