:: Forum >>

XML Problem

I need to parse the following XML to a grid to populate the xml values (Primary, Secondary etc) as Grid column headers.

<bus_contact2>After Hours</bus_contact2>
<tech_contact2>After Hours</tech_contact2>

device.setId('DataGrid');// device is the grid object

var table = new AW.XML.Table;
var str = '/cgi-bin/contacts_report.cgi';
var table_response = table.response;
table.response = function(xml) {
table_response.call(this, xml);
alert(xml);//atleast I want to see the xml being parsed, so that I can make it to display as grid column header. But when I issue an alert statement, it shows blank(object).
get_data(device,table, 8);

function get_data(field, xml,col){
var row = 0;
var cnt = 0;
alert(xml.getCount()); //prints 8, correct;
for (var i=0; i< xml.getCount(); i++){
alert(xml.getData(0, i));//prints nothing
field.setHeaderText(xml.getData(0, i));

Can anyone please help me? I searched for similar issues, but to my bad luck could not find.

Monday, January 7, 2008
The xml argument in table.response(xml) is a DOMDocument object so you should be able to navigate to DOM node using XML DOM API.
Alex (ActiveWidgets)
Tuesday, January 8, 2008
Thanks a lot Alex for your quick response. Yes, that solved the issue. It seems each xml tag returned in response is interpreted as each row, rather than each column. I had to include another loop (with xml.getData() to convert to one row of header data.

Thanks again!
Tuesday, January 8, 2008
Could you perhaps put your updated code here as well?
Wednesday, January 9, 2008

This topic is archived.

Back to support forum

Forum search