3.2.0

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
May 21,
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 {font: 12px 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)
May 21,

This topic is archived.

See also:


Back to support forum