3.2.0

getXML method

Is this method working? It's not returning a value for a table even though the table is working for populating a grid:

var tablesrc = new AW.XML.Table;
tablesrc.setURL("/main/research/companies-simple.xml");
tablesrc.request();
var xml = tablesrc.getXML();
var obj = new AW.UI.Grid;
obj.setColumnCount(5);
obj.setCellModel(tablesrc);

var label = new AW.UI.Label;
label.setControlText( xml );

document.write(obj);
document.write(label);

The value of xml is "undefined".
Curt
August 24,
Yes, this method does work. To correct your example you should add -

tablesrc.setAsync(false);

otherwise the request is asynchronous and the xml data will not be available immediately after the request.
Alex (ActiveWidgets)
August 25,
Hi,

I've also got the same probleme, I'm using a Vortex script called xml1 that ouputs an xml file and I am then using this AW script to show the xml. I get the same error message as Curt even with "table.setAsync(false);" set.

Any hints?

vortex script for for the xml file.

file name : xml1
<SCRIPT LANGUAGE=vortex>
<!-- Global settings -->
<DB = "reflink">
<TIMEOUT = -1>
<H4>Time Exceeded</H4>
Your action exceeded the time limit.
</TIMEOUT>

<!-- Main entry point -->
<a name=main>
<USER = _SYSTEM>
<PASS = "">
<$null = "">
<header NAME=Content-Type VALUE="text/xml;charset=utf-8">
<header NAME=Cache-Control VALUE="no-cache">
<?xml version="1.0" encoding="UTF-8" ?>
<SQL OUTPUT=xml "SELECT NAME,FURL,CATEGORY,SUBCATEGORY,PROVENANCE,REGION from REFLINKS;">
</SQL>
</a>
</SCRIPT>

When the above script is run, the xml looks like this;

<?xml version="1.0" encoding="UTF-8" ?>
<results>
<result>
<NAME>asdas</NAME>
<FURL>das</FURL>
<CATEGORY>Subject-Based Sources</CATEGORY>
<SUBCATEGORY>Women</SUBCATEGORY>
<PROVENANCE>deu</PROVENANCE>
<REGION>Asia</REGION>
</result>
<result>
<NAME>Abo Akademi University</NAME>
<FURL>http://www.abo.fi/aa/engelska/</FURL>
<CATEGORY>Prime Sources</CATEGORY>
<SUBCATEGORY>Academic Institutions</SUBCATEGORY>
<PROVENANCE />
<REGION />
</result>
</results>

And the AW script goes as follows ;

var table = new AW.XML.Table;
table.setAsync(false);
table.setURL("xml");
table.request();
var xml = table.getXML();

var label = new AW.UI.Label;
label.setControlText(xml);
document.write(label);

Ouput = undefined

But if I run this script I get a correct grid output

var obj = new AW.UI.Grid;
obj.setId("grid");
obj.setHeaderText(["URL Name","URL","Category","Subcategory","Country","Region"]);
obj.setColumnCount(6);
obj.setCellModel(table);
document.write(obj);

Alex_gwood
October 19,
Thank you to correct the first AW script and replace table.setURL("xml"); with table.setURL("xml1");

But still doesn't work... :-(
Alex_gwood
October 19,
how do I open xml pages
October 19,

This topic is archived.

See also:


Back to support forum