3.2.0

Not getting data from AW.XML.Table

I'm just got my V2.0 update, and am trying to update my older grid creation logic using an XML table reading a file from the server.

Based on a V2.0 thread in the forum, I've used the following example code for the test:

var dataTable = new AW.XML.Table;
dataTable.setURL("myfilename");
dataTable.setColumns(["Device", "Status", "Timestamp", "Appr Rate", "Balance"]);
dataTable.request();
var gridObj = new AW.UI.Grid;
gridObj.setColumnCount(5);
gridObj.setHeaderText(["Device", "Status", "Timestamp", "Appr Rate", "Balance"]);
gridObj.setCellModel(dataTable);
document.write(gridObj);


If I look at the table right after the dataTable.request();, it contains zero rows. If I wait half a second and look at the table after it's had time to fetch the data, I see 15 rows. If I add gridObj.refresh(); at this point, which I expected to be the last required step, I still see nothing in the grid.

The XML data, from the V1.xx code, looks like this:

<?xml version="1.0"?>
<ArrayOfDevices xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://tempuri.org/">
  <device>
    <id>Y5562201</id>
    <status>Up</status>
    <timestamp>01/01/2006 12:13:15</timestamp>
    <approval>57%</approval>
    <balance>123456</balance>
  </device>
    ...
</ArrayOfDevices>


for 15 devices. When I run this in Windows XP using Firefox V1.5, I get the following error message in the Firefox JavaScript Console:

Error: uncaught exception: [Exception... "The expression is not a legal expression."  code: "51" nsresult: "0x805b0033 (NS_ERROR_DOM_INVALID_EXPRESSION_ERR)"  location: "http://localhost:8080/pages/ActiveWidgets/source/lib/xml/table.js Line: 212"]


The grid I'm testing does display data correctly when loaded from an internal JavaScript array, so the problem seems to be loading data from the AW.XML.Table. This feels like it might be an XML formatting problem to me. Are there any new requirements for formatting XML that I haven't found in the forum yet? Are there any other problems here that I haven't found yet?

Thanks in advance for any help anyone can offer.

JFE.
Jack Emmerichs
March 9,
Humm....

Could this be related to the grid.refresh() bug you mentioned this afternoon?

JFE.
Jack Emmerichs
March 9,
Jack,

I think the problem might be related to xml namespace declaration - xmlns="http://tempuri.org/"

There is an example file in /examples/old/xml-arrayofrecords.htm with a very similar data format - /examples/data/companies-array.xml

If you have a namespace declared in XML file - you should also define it in the table object and use in XPath -

//	define namespace for selecting column data
    table.setNamespace("co", "http://tempuri.org/");

    //	set column XPath
    table.setColumns(["co:ticker", "co:name", "co:marketcap", "co:sales", "co:employees", "co:timestamp"]);
Alex (ActiveWidgets)
March 10,
This originally started as the companies-array.xml file before I changed the text and added the name spaces. Removing the name spaces did not fix the problem--I'm getting the same error message. I'll work on adding namespace information to the tables and see how that goes.

Thanks for the info and the quick reply.

JFE.
Jack Emmerichs
March 10,
Alex:

Okay, the dumb thing I did was to not realize that the columns definition for a table differed from the columns definition of a grid (the the table can now read XML tags--cool), so I was using the column heading values for the table column definitions.

I fixed that, and I now get "undefined" in all the cells, as expected when the table hasn't had time to load the data yet. No error messages showning up now. So far, so good.

However, after the table has loaded and I refresh the grid, I still get "undefined" in all the cells, so this appears to be a grid refresh problem, which may be the one you've mentioned for other queries on V2.0 grids.

Anything I can test to see if this is in fact the problem?

Any idea on what the problem is, or how long until we get a workaround?

Jack Emmerichs
March 12,
Okay, second dumb thing I did was to apply a patch listed in the forum for fixing an XML Table problem sending back formatted data that I wasn't sure I had (can't find it now, unfortuntately), and then forgot about it.

When I did see it again, and removed, it, everything started working just fine. I also found the setAsync(false) option, which makes initial debugging much easier, even if it's not what you want in the long run.

JFE
Jack Emmerichs
March 13,

This topic is archived.

See also:


Back to support forum