:: Forum >> Version 2 >>

Reading XML data from string

I need to read the xml data from a string and put it intot the grid.
How can this be done?Please elaborate
ajay
Monday, May 21, 2007
You can use setXML() method of AW.XML.Table class, which accepts either a reference to the XMLDocument object (IE XML Data Island) or XML string -

table.setXML(ServerXML);

Here is the full example -
<html>
<
head>
    <
title>ActiveWidgets Examples</title>
    <
style>body {font12px Tahoma}</style>
    <
script src="../../runtime/lib/aw.js"></script>
    <
link href="../../runtime/styles/xp/aw.css" rel="stylesheet"></link>
</
head>
<
body>
<
script>

    var 
ServerXML="<companies><company><ticker>MSFT1</ticker><name>Microsoft Corporation</name></company></companies>";

    var 
table = new AW.XML.Table;
    
table.setXML(ServerXML);

    var 
obj = new AW.UI.Grid;
    
obj.setId("myGrid");

    
obj.setCellModel(table);
    
obj.setRowCount(1); // or obj.setRowCount(table.getCount());
    
obj.setColumnCount(2);

    
document.write(obj);

</
script>
</
body>
</
html>
 
There are more examples like this in the /examples/grid data - xml data islands/ directory.

Alex (ActiveWidgets)
Monday, May 21, 2007



This topic is archived.

Back to support forum

Forum search