PDA

View Full Version : Data Island Script: Please Help Me Debug


rik408
12-06-2004, 04:40 PM
This is my 1st attempt at constructing a data island.
I think it is 95% there, but nothing is showing up in the "span dataFld" areas.
I have looked and looked, but I see nothing wrong.
Also, at this point, I do not want to include all elements in the data island, just:

name
manufacturer
summary
description

Can anyone see what the bug is?

Thanks.
---
<html>
<head>

<title>Catalog 4 Data Island</title>

<xml id = "CatIsland">
<?xml version="1.0"?>
<catalog>
<company>Office Magick</company>

<!-- cases implementing 'color-list' element -->
<department name="Office Supplies" code="D235">
<item>
<name>Stapler</name>
<price amt="8.95" />
<manufacturer>Bostich</manufacturer>

<color-list>
<color sku="S367-BL" hex="#000000">black</color>
<color sku="S367-PY" hex="#ffffcc">pastel yellow</color>
<color sku="S367-WH" hex="#ffffff">white</color>
</color-list>
<summary>Heavy-duty office stapler</summary>
<description>

This stapler has a 30-sheet capacity and a lever
action for accurate placement.
</description>
</item>
<item>
<name>Hole Punch</name>
<price amt="12.95" />
<color-list>
<color sku="HP367-BL" hex="#000000">black</color>

<color sku="HP367-WH" hex="#ffffff">white</color>
</color-list>
<summary>Heavy-duty office hole punch</summary>
<description>
This hole punch has a 30-sheet capacity and a lever
action for accurate placement.
</description>
</item>
<item>

<name>Pencil Sharpener</name>
<price amt="20.95" />
<manufacturer>Shar-pens</manufacturer>
<color-list>
<color sku="PS367-GR" hex="#666666">gray</color>
<color sku="PS367-PY" hex="#ffffcc">pastel yellow</color>
</color-list>

<summary>Electric pencil sharpener</summary>
</item>
<item>
<name>Notebook</name>
<price amt="3.00" units="CDN"/>
<manufacturer>Pentel</manufacturer>
<color-list>

<color sku="N1783-GR">Green</color>
<color sku="N1783-YE">Yellow</color>
<color sku="N1783-Rd">Red</color>
</color-list>
<summary>80-page notebook</summary>
<description>
This notepad contain 80 line pages and is
coil bound.
</description>

</item>
<item>
<name>Eraser</name>
<price amt="0.75" units="USD"/>
<color-list>
<color sku="E783-PI">Pink</color>
<color sku="E783-WH">White</color>

</color-list>
<summary>Pearl eraser</summary>
<description>
This eraser is a pencil eraser.
</description>
</item>
<item>
<name>Pencil</name>

<price amt="1.49"/>
<manufacturer>Sharp</manufacturer>
<color-list>
<color sku="P83-GR">Green</color>
<color sku="P83-YE">Yellow</color>
<color sku="P83-RE">Red</color>
</color-list>

<summary>Mechanical pencil</summary>
</item>
</department>

<!-- cases implementing 'color' element -->
<department name="Computer Peripherals" code="D240">
<item>
<name>Zip Drive</name>

<price units="USD" amt="100.00"/>
<manufacturer>IOMEGA</manufacturer>
<color hex="#000000" sku="ZD250">Black</color>
<summary>250 MByte Zip Drive</summary>
<description>
Features of this 250 MByte Zip Drive:
USB Interface
Built-in power supply; no "brick adapter" required
Can read and write 100MB Zip disks
</description>
</item>

<item>
<name>USB Extender Cable</name>
<price amt="8.95"/>
<color sku="UC520-MM">Black</color>
<summary>USB Extender Cable</summary>
<description>
This is a 3-meter USB extender cable,
with a male-to-male adapter.
</description>

</item>

<!-- cases implementing 'color' element -->
<item>
<name>USB2 Cable</name>
<price amt="6.95"/>
<sku>U2C520</sku>
<summary>USB2 Cable - 2 meter</summary>

<description>
This is a two-meter USB2 Cable.
For longer distances, consider
purchasing a USB Extender cable.
</description>
</item>
<item>
<name>USB Cable</name>
<price amt="8.95" units="CDN"/>
<manufacturer>ABC Cable Corp</manufacturer>

<sku>UC520</sku>
<summary>USB Cable - 1 meter</summary>
<description>
This is a one-meter USB Cable.
For longer distances, consider
purchasing a USB Extender cable.
</description>
</item>
</department>
</catalog>
</xml>
</head>
<body>
<table dataSrc="#CatIsland" datapagesize="1" id="CatTable" border="1">
<thead>
<tr>
<th colspan="2" style = "background-color:#FFFF00;">Office Magick </th>
</tr>
<tr>
<th>Department: Computer Peripherals</th>
</tr>
</thead>
<tbody>
<tr valign="bottom">
<td>
<table datasrc="#CatIsland" dataFld="item" border="1">
<tbody>
<tr>
<td><span dataFld = "name"></span></td>
<td><span dataFld = "manufacturer"></span></td>
<td><span dataFld = "summary"></span></td>
<td><span dataFld = "description"></span></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2" align = "center">
<button onClick="CatTable.firstPage()">First</button>
<button onClick="CatTable.previousPage()">Prev</button>
<button onClick="CatTable.nextPage()">Next</button>
<button onClick="CatTable.lastPage()">Last</button>

</td>
</tr>
</tfoot>

</table>
</body>
</html>

codegoboom
12-15-2004, 02:07 PM
Alright, I pasted your thing, and removed the <company> node. That alone got the table to populate (why, exactly, I'm not sure).
To page items individually, you'd need to remove the "datasrc" attribute from the outer table, and move the "datapagesize" & "id" attributes to the inner table.
As for the company name, just make that an attribute of <catalog>, or something... ;)