:: Documentation >>

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

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

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