:: Home >>

XML data

Lets look how to load simple XML data into the grid.

Here is the XML (click to open):

<companies>
    <company>
        <ticker>MSFT</ticker>
        <name>Microsoft Corporation</name>
        <mktcap>314,571.156</mktcap>
        <sales>32,187.000</sales>
        <employees>55000</employees>
    </company>
    <company>
        <ticker>ORCL</ticker>
        <name>Oracle Corporation</name>
        <mktcap>62,615.266</mktcap>
        <sales>9,519.000</sales>
        <employees>40650</employees>
    </company>
...

To load and transform XML data you need an XML table model.

var table = new Active.XML.Table;

Assign a URL of the XML file.

table.setProperty("URL", "/examples/data/companies-simple.xml");

By default the model looks at the documentElement as the data root. Then all child elements of the root are treated as rows and the child elements of each row node become the table cells. Exactly as this simple example looks like.

Just load the file.

table.request();

After the grid object is created

var obj = new Active.Controls.Grid;
obj.setProperty("column/count", 5);

it is assigned our new external data model.

obj.setModel("data", table);

And finally write the grid HTML to the page.

document.write(obj);

Comments

28 Dec 06
Editable date fields from an XML file... German (1)
16 Feb 06
Dynamically Adding a row to a table Vernon (1)
14 Feb 06
Take tag attributes as columns Arturo Guerrero (2)
XML data load... Yossi (6)
ADO.Recordset Kevin (1)
31 Jan 06
ActiveWidgets grid with / con PHP (5)
8 Jan 06
Is there any way to save this data to disk? Paul R. (3)
16 Dec 05
implement this feature in jsp and deploy in tomcat 15383 (0)
3 Nov 05
Can I load data from a spreadsheet? Suresh (1)
XML data from a servlet ? (1)
2 Nov 05
Call on an Event Nihar (0)
18 Oct 05
Empty XML tags (<N/>) are not parsed in FireFox Meindert Hoving (2)
14 Oct 05
[no subject] vernon (2)
9 Oct 05
XML OUTPUT panduran (0)
5 Jul 05
What could be wrong with this way of loading from XML file? Equinoxe (0)
27 Jun 05
XML input Anitha (6)
20 Jun 05
XML DOM loading Ravi (3)
17 Jun 05
Data Load Manvi (0)
14 Apr 05
Are there limitations on the XML string length? Mikhail (1)

Comments will appear on this page and in the main forum.

Documentation:

Recent changes:

2.6.4
2.6.3
2.6.2
2.6.1
2.6.1
2.6.0
2.5.0 - 2.5.6
2.5.6
2.5.0 - 2.5.5
2.5.5