After clicking the "generate xml table" button, a table is displayed in the DIV tag with the ID "odiv_createxmltable", whose content is XML data.
<XML id = "oxmldata">
<Tab>
<Row>
<Col name = "col1"/>
<Col name = "col2"/>
<Col name = "col3"/>
</Row>
<Row>
<Col name = "col4"/>
<Col name = "col5"/>
<Col name = "col6"/>
</Row>
<Row>
<Col name = "col7"/>
<Col name = "col8"/>
<Col name = "col9"/>
</Row>
</TAB>
</XML>
<Input type = "button" value = "generate an XML table" onclick = "createxmltable ()">
<Div id = "odiv_createxmltable"> </div>
<Script language = "JavaScript">
Function createxmltable (){
VaR html = '';
VaR ROW = oxmldata. xmldocument. getelementsbytagname ('row ');
VaR Col = oxmldata. xmldocument. getelementsbytagname ('col ');
HTML + = '<Table Border> <tr> ';
For (I = 1; I <col. Length + 1; I ++ ){
HTML + = '<TD>' + Col [I-1]. getattribute ('name') + '</TD> ';
If (I % row. Length = 0 & I! = Col. Length) HTML + = '</tr> <tr> ';
}
HTML + = '</tr> </table> ';
Odiv_createxmltable.innerhtml = HTML;
}
</SCRIPT>